@@ -241,7 +241,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
* Zero length reads always succeed, even if no device is connected
*/
- while (time_is_after_jiffies(timeout)) {
+ do {
/* Read data from i2c device */
ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len);
if (ret < 0) {
@@ -270,7 +270,8 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
if (ret != 0x10)
break;
msleep(5);
- }
+ } while (time_is_after_jiffies(timeout));
+
if (ret == 0x10) {
em28xx_warn("I2C transfer timeout on read from addr 0x%02x", addr);
return -ENODEV;