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-i801.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-i801.c')
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 10411848fd70..9d2c5adf5d4f 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -237,7 +237,7 @@ static int i801_transaction(int xact) | |||
237 | status = inb_p(SMBHSTSTS); | 237 | status = inb_p(SMBHSTSTS); |
238 | } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT)); | 238 | } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT)); |
239 | 239 | ||
240 | result = i801_check_post(status, timeout >= MAX_TIMEOUT); | 240 | result = i801_check_post(status, timeout > MAX_TIMEOUT); |
241 | if (result < 0) | 241 | if (result < 0) |
242 | return result; | 242 | return result; |
243 | 243 | ||
@@ -257,9 +257,9 @@ static void i801_wait_hwpec(void) | |||
257 | } while ((!(status & SMBHSTSTS_INTR)) | 257 | } while ((!(status & SMBHSTSTS_INTR)) |
258 | && (timeout++ < MAX_TIMEOUT)); | 258 | && (timeout++ < MAX_TIMEOUT)); |
259 | 259 | ||
260 | if (timeout >= MAX_TIMEOUT) { | 260 | if (timeout > MAX_TIMEOUT) |
261 | dev_dbg(&I801_dev->dev, "PEC Timeout!\n"); | 261 | dev_dbg(&I801_dev->dev, "PEC Timeout!\n"); |
262 | } | 262 | |
263 | outb_p(status, SMBHSTSTS); | 263 | outb_p(status, SMBHSTSTS); |
264 | } | 264 | } |
265 | 265 | ||
@@ -344,7 +344,7 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | |||
344 | while ((!(status & SMBHSTSTS_BYTE_DONE)) | 344 | while ((!(status & SMBHSTSTS_BYTE_DONE)) |
345 | && (timeout++ < MAX_TIMEOUT)); | 345 | && (timeout++ < MAX_TIMEOUT)); |
346 | 346 | ||
347 | result = i801_check_post(status, timeout >= MAX_TIMEOUT); | 347 | result = i801_check_post(status, timeout > MAX_TIMEOUT); |
348 | if (result < 0) | 348 | if (result < 0) |
349 | return result; | 349 | return result; |
350 | 350 | ||