summaryrefslogtreecommitdiff
path: root/drivers/i2c/busses/i2c-piix4.c
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2010-01-16 22:43:12 +0300
committerJean Delvare <khali@linux-fr.org>2010-01-16 22:43:12 +0300
commitb6a3195070fe1c12d0bb1099ffe997d8abf9f602 (patch)
treec53534397e22f9260820a635a3f3537d1a416748 /drivers/i2c/busses/i2c-piix4.c
parent0b2c3688445ff02d3f1bfffc6983417b28f8c3da (diff)
downloadlinux-b6a3195070fe1c12d0bb1099ffe997d8abf9f602.tar.xz
i2c: Test off by one in {piix4,vt596}_transaction()
With `while (timeout++ < MAX_TIMEOUT)' timeout reaches MAX_TIMEOUT + 1 after the loop. This is probably unlikely to produce a problem. 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-piix4.c')
-rw-r--r--drivers/i2c/busses/i2c-piix4.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 1e245e9cad31..e56e4b6823ca 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -324,12 +324,12 @@ static int piix4_transaction(void)
else
msleep(1);
- while ((timeout++ < MAX_TIMEOUT) &&
+ while ((++timeout < MAX_TIMEOUT) &&
((temp = inb_p(SMBHSTSTS)) & 0x01))
msleep(1);
/* If the SMBus is still busy, we give up */
- if (timeout >= MAX_TIMEOUT) {
+ if (timeout == MAX_TIMEOUT) {
dev_err(&piix4_adapter.dev, "SMBus Timeout!\n");
result = -ETIMEDOUT;
}