diff mbox series

[2/2] i2c: robotfuzz-osif: drop pointless test

Message ID 20180509194658.29106-2-peda@axentia.se
State Accepted
Headers show
Series [1/2] i2c: robotfuzz-osif: remove pointless local variable | expand

Commit Message

Peter Rosin May 9, 2018, 7:46 p.m. UTC
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(-)

Comments

Wolfram Sang May 24, 2018, 8:17 p.m. UTC | #1
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 :(
diff mbox series

Patch

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) {