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>

authored by Roel Kluin and committed by Jean Delvare b6a31950 0b2c3688

+4 -4
+2 -2
drivers/i2c/busses/i2c-piix4.c
··· 324 324 else 325 325 msleep(1); 326 326 327 - while ((timeout++ < MAX_TIMEOUT) && 327 + while ((++timeout < MAX_TIMEOUT) && 328 328 ((temp = inb_p(SMBHSTSTS)) & 0x01)) 329 329 msleep(1); 330 330 331 331 /* If the SMBus is still busy, we give up */ 332 - if (timeout >= MAX_TIMEOUT) { 332 + if (timeout == MAX_TIMEOUT) { 333 333 dev_err(&piix4_adapter.dev, "SMBus Timeout!\n"); 334 334 result = -ETIMEDOUT; 335 335 }
+2 -2
drivers/i2c/busses/i2c-viapro.c
··· 165 165 do { 166 166 msleep(1); 167 167 temp = inb_p(SMBHSTSTS); 168 - } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT)); 168 + } while ((temp & 0x01) && (++timeout < MAX_TIMEOUT)); 169 169 170 170 /* If the SMBus is still busy, we give up */ 171 - if (timeout >= MAX_TIMEOUT) { 171 + if (timeout == MAX_TIMEOUT) { 172 172 result = -ETIMEDOUT; 173 173 dev_err(&vt596_adapter.dev, "SMBus timeout!\n"); 174 174 }