i2c: sh_mobile: fix timeout error handling
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Thu, 17 Jan 2013 09:45:55 +0000 (10:45 +0100)
committerWolfram Sang <wolfram@the-dreams.de>
Sun, 10 Feb 2013 18:55:23 +0000 (19:55 +0100)
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 <g.liakhovetski@gmx.de>
Signed-off-by: Wolfram Sang <wolfram@the-dreams.de>
drivers/i2c/busses/i2c-sh_mobile.c

index 34024f3..daaf0eb 100644 (file)
@@ -521,8 +521,11 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
                k = wait_event_timeout(pd->wait,
                                       pd->sr & (ICSR_TACK | SW_DONE),
                                       5 * HZ);
-               if (!k)
+               if (!k) {
                        dev_err(pd->dev, "Transfer request timed out\n");
+                       err = -ETIMEDOUT;
+                       break;
+               }
 
                retry_count = 1000;
 again: