From af62aaaac5cacd7ee976e5cc56172d8b94a20034 Mon Sep 17 00:00:00 2001 From: David Wu Date: Sun, 8 Feb 2015 21:38:22 +0800 Subject: [PATCH] i2c: fix retry_count to return error when i2c bus checkidle was low Signed-off-by: David Wu --- drivers/i2c/busses/i2c-rockchip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rockchip.c b/drivers/i2c/busses/i2c-rockchip.c index 3f64ff054538..953251121fe5 100644 --- a/drivers/i2c/busses/i2c-rockchip.c +++ b/drivers/i2c/busses/i2c-rockchip.c @@ -741,7 +741,7 @@ static int rockchip_i2c_xfer(struct i2c_adapter *adap, clk_enable(i2c->clk); if (i2c->check_idle) { int state, retry = 10; - while (retry--) { + while (retry) { state = rockchip_i2c_check_idle(i2c); if (state == I2C_IDLE) break; @@ -749,6 +749,7 @@ static int rockchip_i2c_xfer(struct i2c_adapter *adap, mdelay(10); else msleep(10); + retry--; } if (retry == 0) { dev_err(i2c->dev, "i2c is not in idle(state = %d)\n", state); -- 2.34.1