Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
writeb(temp, &i2c_regs->i2cr);
ret = tx_byte(i2c_regs, (chip << 1) | 1);
- if (ret < 0)
+ if (ret < 0) {
+ i2c_imx_stop();
return ret;
+ }
/* setup bus to read data */
temp = readb(&i2c_regs->i2cr);
/* read data */
for (i = 0; i < len; i++) {
ret = i2c_imx_trx_complete();
- if (ret)
+ if (ret) {
+ i2c_imx_stop();
return ret;
+ }
/*
* It must generate STOP before read I2DR to prevent
for (i = 0; i < len; i++) {
ret = tx_byte(i2c_regs, buf[i]);
if (ret < 0)
- return ret;
+ break;
}
i2c_imx_stop();