summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfram Sang <wsa@kernel.org>2023-02-20 17:40:59 +0300
committerWolfram Sang <wsa@kernel.org>2023-03-03 23:00:26 +0300
commit4b3dfb0ed6336dea4a763ce9fa30a42763eb3800 (patch)
treed39a7440fb17f1f035e434f5dcdea048700ec839
parent1d092308ce223bb1403475737b8fb847e9e8704c (diff)
downloadlinux-4b3dfb0ed6336dea4a763ce9fa30a42763eb3800.tar.xz
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 <wsa@kernel.org>
-rw-r--r--drivers/i2c/busses/i2c-gxp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c
index 352dedf6292f..fda7809e72ba 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;