Skip to content

Commit 5687265

Browse files
lyakhwsakernel
authored andcommitted
i2c: sh_mobile: fix timeout error handling
In a timeout case return an error immediately from the driver's .master_xfer() method, instead of continuing and letting higher layers fail. Signed-off-by: Guennadi Liakhovetski <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 05cf936 commit 5687265

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/i2c/busses/i2c-sh_mobile.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,11 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
521521
k = wait_event_timeout(pd->wait,
522522
pd->sr & (ICSR_TACK | SW_DONE),
523523
5 * HZ);
524-
if (!k)
524+
if (!k) {
525525
dev_err(pd->dev, "Transfer request timed out\n");
526+
err = -ETIMEDOUT;
527+
break;
528+
}
526529

527530
retry_count = 1000;
528531
again:

0 commit comments

Comments
 (0)