diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-05-05 02:39:24 -0400 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-05-05 02:39:24 -0400 |
commit | 4ccc28f725bc2b7b0a3bc27e9c15f4eaf63fb812 (patch) | |
tree | f1a3a3424713340aabb5722fc1accad149fc5052 /drivers/i2c/busses/i2c-amd756.c | |
parent | b4348f32dae3cb6eb4bc21c7ed8f76c0b11e9d6a (diff) |
i2c: Timeouts off by 1
with while (timeout++ < MAX_TIMEOUT); timeout reaches MAX_TIMEOUT + 1
after the loop, so the tests below are off by one.
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-amd756.c')
-rw-r--r-- | drivers/i2c/busses/i2c-amd756.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 220f4a1eee1d..f7d6fe9c49ba 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -126,7 +126,7 @@ static int amd756_transaction(struct i2c_adapter *adap) | |||
126 | } while ((temp & (GS_HST_STS | GS_SMB_STS)) && | 126 | } while ((temp & (GS_HST_STS | GS_SMB_STS)) && |
127 | (timeout++ < MAX_TIMEOUT)); | 127 | (timeout++ < MAX_TIMEOUT)); |
128 | /* If the SMBus is still busy, we give up */ | 128 | /* If the SMBus is still busy, we give up */ |
129 | if (timeout >= MAX_TIMEOUT) { | 129 | if (timeout > MAX_TIMEOUT) { |
130 | dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp); | 130 | dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp); |
131 | goto abort; | 131 | goto abort; |
132 | } | 132 | } |
@@ -143,7 +143,7 @@ static int amd756_transaction(struct i2c_adapter *adap) | |||
143 | } while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT)); | 143 | } while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT)); |
144 | 144 | ||
145 | /* If the SMBus is still busy, we give up */ | 145 | /* If the SMBus is still busy, we give up */ |
146 | if (timeout >= MAX_TIMEOUT) { | 146 | if (timeout > MAX_TIMEOUT) { |
147 | dev_dbg(&adap->dev, "Completion timeout!\n"); | 147 | dev_dbg(&adap->dev, "Completion timeout!\n"); |
148 | goto abort; | 148 | goto abort; |
149 | } | 149 | } |