i2c: Timeouts reach -1
authorRoel Kluin <roel.kluin@gmail.com>
Wed, 25 Feb 2009 20:26:21 +0000 (21:26 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:53:03 +0000 (17:53 -0700)
commitfaccffd54fa78cc094740ccc902e0a1189c61c27
tree2a1e882c1e3900d7766fd010aeac71e159db55f1
parentb8d6b5d91b85c08b5f5df856d602fbb2c5da8162
i2c: Timeouts reach -1

commit a746b578d8406b2db0e9f0d040061bc1f78433cf upstream

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/busses/i2c-amd8111.c
drivers/i2c/busses/i2c-pxa.c