* [PATCH 1/2] i2c: robotfuzz-osif: remove pointless local variable
@ 2018-05-09 19:46 Peter Rosin
2018-05-09 19:46 ` [PATCH 2/2] i2c: robotfuzz-osif: drop pointless test Peter Rosin
2018-05-24 20:15 ` [PATCH 1/2] i2c: robotfuzz-osif: remove pointless local variable Wolfram Sang
0 siblings, 2 replies; 4+ messages in thread
From: Peter Rosin @ 2018-05-09 19:46 UTC (permalink / raw)
To: linux-kernel; +Cc: Peter Rosin, linux-i2c
Just use the value directly instead of assigning it to a
variable first. And then drop the unused variable.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/i2c/busses/i2c-robotfuzz-osif.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
index 9c0f52b7ff7e..51d93b4b00f2 100644
--- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
+++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
@@ -63,26 +63,23 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
struct osif_priv *priv = adapter->algo_data;
struct i2c_msg *pmsg;
int ret = 0;
- int i, cmd;
+ int i;
for (i = 0; ret >= 0 && i < num; i++) {
pmsg = &msgs[i];
if (pmsg->flags & I2C_M_RD) {
- cmd = OSIFI2C_READ;
-
- ret = osif_usb_read(adapter, cmd, pmsg->flags,
- pmsg->addr, pmsg->buf,
- pmsg->len);
+ ret = osif_usb_read(adapter, OSIFI2C_READ,
+ pmsg->flags, pmsg->addr,
+ pmsg->buf, pmsg->len);
if (ret != pmsg->len) {
dev_err(&adapter->dev, "failure reading data\n");
return -EREMOTEIO;
}
} else {
- cmd = OSIFI2C_WRITE;
-
- ret = osif_usb_write(adapter, cmd, pmsg->flags,
- pmsg->addr, pmsg->buf, pmsg->len);
+ ret = osif_usb_write(adapter, OSIFI2C_WRITE,
+ pmsg->flags, pmsg->addr,
+ pmsg->buf, pmsg->len);
if (ret != pmsg->len) {
dev_err(&adapter->dev, "failure writing data\n");
return -EREMOTEIO;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] i2c: robotfuzz-osif: drop pointless test
2018-05-09 19:46 [PATCH 1/2] i2c: robotfuzz-osif: remove pointless local variable Peter Rosin
@ 2018-05-09 19:46 ` Peter Rosin
2018-05-24 20:17 ` Wolfram Sang
2018-05-24 20:15 ` [PATCH 1/2] i2c: robotfuzz-osif: remove pointless local variable Wolfram Sang
1 sibling, 1 reply; 4+ messages in thread
From: Peter Rosin @ 2018-05-09 19:46 UTC (permalink / raw)
To: linux-kernel; +Cc: Peter Rosin, linux-i2c
In the for-loop test, ret will be either 0 or 1. So, the
comparison is pointless. Drop it, and drop the initializer
which is then also pointless.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/i2c/busses/i2c-robotfuzz-osif.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
index 51d93b4b00f2..d848cf515234 100644
--- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
+++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
@@ -62,10 +62,10 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
{
struct osif_priv *priv = adapter->algo_data;
struct i2c_msg *pmsg;
- int ret = 0;
+ int ret;
int i;
- for (i = 0; ret >= 0 && i < num; i++) {
+ for (i = 0; i < num; i++) {
pmsg = &msgs[i];
if (pmsg->flags & I2C_M_RD) {
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] i2c: robotfuzz-osif: remove pointless local variable
2018-05-09 19:46 [PATCH 1/2] i2c: robotfuzz-osif: remove pointless local variable Peter Rosin
2018-05-09 19:46 ` [PATCH 2/2] i2c: robotfuzz-osif: drop pointless test Peter Rosin
@ 2018-05-24 20:15 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2018-05-24 20:15 UTC (permalink / raw)
To: Peter Rosin; +Cc: linux-kernel, linux-i2c
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
On Wed, May 09, 2018 at 09:46:57PM +0200, Peter Rosin wrote:
> Just use the value directly instead of assigning it to a
> variable first. And then drop the unused variable.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] i2c: robotfuzz-osif: drop pointless test
2018-05-09 19:46 ` [PATCH 2/2] i2c: robotfuzz-osif: drop pointless test Peter Rosin
@ 2018-05-24 20:17 ` Wolfram Sang
0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2018-05-24 20:17 UTC (permalink / raw)
To: Peter Rosin; +Cc: linux-kernel, linux-i2c
[-- Attachment #1: Type: text/plain, Size: 456 bytes --]
On Wed, May 09, 2018 at 09:46:58PM +0200, Peter Rosin wrote:
> In the for-loop test, ret will be either 0 or 1. So, the
> comparison is pointless. Drop it, and drop the initializer
> which is then also pointless.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
Applied to for-next, thanks!
Reading that function, it also seems this driver wrongly sends a STOP
after every message of a transfer. And not just at the end of the
transfer :(
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-24 20:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 19:46 [PATCH 1/2] i2c: robotfuzz-osif: remove pointless local variable Peter Rosin
2018-05-09 19:46 ` [PATCH 2/2] i2c: robotfuzz-osif: drop pointless test Peter Rosin
2018-05-24 20:17 ` Wolfram Sang
2018-05-24 20:15 ` [PATCH 1/2] i2c: robotfuzz-osif: remove pointless local variable Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).