From: Wolfram Sang Date: Mon, 20 Feb 2023 14:40:59 +0000 (+0100) Subject: i2c: gxp: return proper error on address NACK X-Git-Tag: v6.6.7~3336^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b3dfb0ed6336dea4a763ce9fa30a42763eb3800;p=platform%2Fkernel%2Flinux-starfive.git 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 --- 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;