diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-02-24 19:19:48 +0100 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-02-24 19:19:48 +0100 |
commit | a746b578d8406b2db0e9f0d040061bc1f78433cf (patch) | |
tree | ce79fc247342fa9fde8ad184a4ec39d70ce0012a /drivers/i2c/busses/i2c-pxa.c | |
parent | i2c: Fix misplaced parentheses (diff) | |
download | linux-a746b578d8406b2db0e9f0d040061bc1f78433cf.tar.xz linux-a746b578d8406b2db0e9f0d040061bc1f78433cf.zip |
i2c: Timeouts reach -1
With a postfix decrement these timeouts reach -1 rather than 0, but
after the loop it is tested whether they have become 0.
As pointed out by Jean Delvare, the condition we are waiting for should
also be tested before the timeout. With the current order, you could
exit with a timeout error while the job is actually done.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-pxa.c')
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 6af68146c342..bdb1f7510e91 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -644,7 +644,7 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c, i2c_pxa_start_message(i2c); - while (timeout-- && i2c->msg_num > 0) { + while (i2c->msg_num > 0 && --timeout) { i2c_pxa_handler(0, i2c); udelay(10); } |