[PATCH] i2c: recovery: directly exit when SCL is stuck low

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If SCL is stuck low, the bus cannot be recovered. No need to check SDA
or futilely trying to send a STOP. Just exit.

Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
---
 drivers/i2c/i2c-core-base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index bfefeb2ab2fd..cbbfe3fd387b 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -189,7 +189,7 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap)
 				dev_err(&adap->dev,
 					"SCL is stuck low, exit recovery\n");
 				ret = -EBUSY;
-				break;
+				goto exit_unprepare;
 			}
 			/* Break if SDA is high */
 			if (bri->get_sda && bri->get_sda(adap))
@@ -227,6 +227,7 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap)
 		ndelay(RECOVERY_NDELAY / 2);
 	}
 
+ exit_unprepare:
 	if (bri->unprepare_recovery)
 		bri->unprepare_recovery(adap);
 
-- 
2.11.0




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux