diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-robotfuzz-osif.c')
-rw-r--r-- | drivers/i2c/busses/i2c-robotfuzz-osif.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c index 9c0f52b7ff7e..d848cf515234 100644 --- a/drivers/i2c/busses/i2c-robotfuzz-osif.c +++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c @@ -62,27 +62,24 @@ 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 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) { - 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; |