[Skiboot] [PATCH 1/2] i2c: Fix multiple-enqueue of the same request on NACK
Benjamin Herrenschmidt
benh at kernel.crashing.org
Tue Aug 14 16:44:59 AEST 2018
i2c_request_send() will retry the request if the error is a NAK,
however it forgets to clear the "ud.done" flag. It will thus
loop again and try to re-enqueue the same request causing internal
request list corruption.
Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
core/i2c.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/core/i2c.c b/core/i2c.c
index d4311c27..070a0f6f 100644
--- a/core/i2c.c
+++ b/core/i2c.c
@@ -224,11 +224,10 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write,
rc = ud.rc;
- if (rc == OPAL_I2C_NACK_RCVD)
- continue;
- else
- /* error or success */
+ /* error or success */
+ if (rc != OPAL_I2C_NACK_RCVD)
break;
+ ud.done = false;
}
prlog(PR_DEBUG, "I2C: %s req op=%x offset=%x buf=%016llx buflen=%d "
More information about the Skiboot
mailing list