From 4b3dfb0ed6336dea4a763ce9fa30a42763eb3800 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Mon, 20 Feb 2023 15:40:59 +0100 Subject: [PATCH] i2c: gxp: return proper error on address NACK According to Documentation/i2c/fault-codes.rst, NACK after sending an address should be -ENXIO. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-gxp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c index 352dedf..fda7809 100644 --- a/drivers/i2c/busses/i2c-gxp.c +++ b/drivers/i2c/busses/i2c-gxp.c @@ -129,8 +129,10 @@ static int gxp_i2c_master_xfer(struct i2c_adapter *adapter, if (time_left == 0) return -ETIMEDOUT; - if (drvdata->state == GXP_I2C_ADDR_NACK || - drvdata->state == GXP_I2C_DATA_NACK) + if (drvdata->state == GXP_I2C_ADDR_NACK) + return -ENXIO; + + if (drvdata->state == GXP_I2C_DATA_NACK) return -EIO; return ret; -- 2.7.4