diff mbox

[3/4] i2c: meson: fix return codes on error

Message ID 20171126164057.27728-4-b.galvani@gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Beniamino Galvani Nov. 26, 2017, 4:40 p.m. UTC
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>
---
 drivers/i2c/meson_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Glass Nov. 27, 2017, 5:09 p.m. UTC | #1
On 26 November 2017 at 09:40, Beniamino Galvani <b.galvani@gmail.com> wrote:
> 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>
> ---
>  drivers/i2c/meson_i2c.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Heiko Schocher Dec. 7, 2017, 8:25 a.m. UTC | #2
Hello Beniamino,

Am 26.11.2017 um 17:40 schrieb Beniamino Galvani:
> 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>
> ---
>   drivers/i2c/meson_i2c.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Thanks!

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
Heiko Schocher Dec. 7, 2017, 12:20 p.m. UTC | #3
Hello Beniamino,

Am 26.11.2017 um 17:40 schrieb Beniamino Galvani:
> 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>
> ---
>   drivers/i2c/meson_i2c.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Applied to u-boot-i2c master

Thanks!

bye,
Heiko
diff mbox

Patch

diff --git a/drivers/i2c/meson_i2c.c b/drivers/i2c/meson_i2c.c
index 84e1997c76..2f39214ad2 100644
--- a/drivers/i2c/meson_i2c.c
+++ b/drivers/i2c/meson_i2c.c
@@ -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;