Skip to content

Commit

Permalink
i2c: gxp: return proper error on address NACK
Browse files Browse the repository at this point in the history
According to Documentation/i2c/fault-codes.rst, NACK after sending an
address should be -ENXIO.

Signed-off-by: Wolfram Sang <[email protected]>
  • Loading branch information
wsakernel committed Mar 3, 2023
1 parent 1d09230 commit 4b3dfb0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/i2c/busses/i2c-gxp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4b3dfb0

Please sign in to comment.