summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-octeon-core.c
diff options
context:
space:
mode:
authorJan Glauber <jglauber@cavium.com>2016-09-23 11:40:39 +0200
committerWolfram Sang <wsa@the-dreams.de>2016-09-24 11:22:24 +0200
commit70121f7f3725c82e8927a4e03ca1d50c98bbc6d2 (patch)
tree29d0e13b40b0471d26047c270a78207748624ac7 /drivers/i2c/busses/i2c-octeon-core.c
parentfcbd4bddb314346a35295701f385b9627bb3a137 (diff)
i2c: octeon: thunderx: Limit register access retries
Do not infinitely retry register readq and writeq operations in order to not lock up the CPU in case the TWSI gets stuck. Return -ETIMEDOUT in case of a failed data read. For all other cases just return so subsequent operations will fail. Signed-off-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-octeon-core.c')
-rw-r--r--drivers/i2c/busses/i2c-octeon-core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c
index 5e63b17f935d..419b54bfc7c7 100644
--- a/drivers/i2c/busses/i2c-octeon-core.c
+++ b/drivers/i2c/busses/i2c-octeon-core.c
@@ -381,7 +381,9 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target,
if (result)
return result;
- data[i] = octeon_i2c_data_read(i2c);
+ data[i] = octeon_i2c_data_read(i2c, &result);
+ if (result)
+ return result;
if (recv_len && i == 0) {
if (data[i] > I2C_SMBUS_BLOCK_MAX + 1)
return -EPROTO;