]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
i2c: meson: fix return codes on error
authorBeniamino Galvani <b.galvani@gmail.com>
Sun, 26 Nov 2017 16:40:56 +0000 (17:40 +0100)
committerHeiko Schocher <hs@denx.de>
Thu, 7 Dec 2017 08:28:31 +0000 (09:28 +0100)
Change meson_i2c_xfer_msg() to return -EREMOTEIO in case of NACK, as
done by other drivers. Also, don't change the return error in
meson_i2c_xfer().

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/i2c/meson_i2c.c

index 84e1997c760c77fc40d3af77fed06d5b2a9688fa..2f39214ad22aa3ec646a81c8111197f1f2d5cc9e 100644 (file)
@@ -178,7 +178,7 @@ static int meson_i2c_xfer_msg(struct meson_i2c *i2c, struct i2c_msg *msg,
 
                if (readl(&i2c->regs->ctrl) & REG_CTRL_ERROR) {
                        debug("meson i2c: error\n");
-                       return -ENXIO;
+                       return -EREMOTEIO;
                }
 
                if ((msg->flags & I2C_M_RD) && i2c->count) {
@@ -200,7 +200,7 @@ static int meson_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
        for (i = 0; i < nmsgs; i++) {
                ret = meson_i2c_xfer_msg(i2c, msg + i, i == nmsgs - 1);
                if (ret)
-                       return -EREMOTEIO;
+                       return ret;
        }
 
        return 0;