aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-08-14 16:44:59 +1000
committerStewart Smith <stewart@linux.ibm.com>2018-08-16 18:28:10 +1000
commit58a86b8101c82deda94e85838fd10a3dbaf210f5 (patch)
tree1d65bdd2dfc43b3e2bbd6d03e7513f726f9cbbe6
parente72a16c4c0a12cb50c83cd47070fda28060e86b0 (diff)
downloadskiboot-58a86b8101c82deda94e85838fd10a3dbaf210f5.zip
skiboot-58a86b8101c82deda94e85838fd10a3dbaf210f5.tar.gz
skiboot-58a86b8101c82deda94e85838fd10a3dbaf210f5.tar.bz2
i2c: Fix multiple-enqueue of the same request on NACK
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@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com> (cherry picked from commit f737777b34382d5293901c4a5040b1fad05294a0) Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--core/i2c.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/i2c.c b/core/i2c.c
index d4311c2..070a0f6 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 "