]> git.sur5r.net Git - u-boot/commitdiff
smc911x: fix the timeout detection
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Wed, 8 May 2013 21:42:44 +0000 (21:42 +0000)
committerTom Rini <trini@ti.com>
Wed, 15 May 2013 12:41:03 +0000 (08:41 -0400)
If timeout is occurred at the while loop above,
the value of 'timeout' is -1, not 0.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
drivers/net/smc911x.h

index a290073bb8b42814c8129aba4f25647c3ea93b7f..f63a0695e375f7f916359b8b62274f6ef06041db 100644 (file)
@@ -484,7 +484,7 @@ static void smc911x_reset(struct eth_device *dev)
                while (timeout-- &&
                        !(smc911x_reg_read(dev, PMT_CTRL) & PMT_CTRL_READY))
                        udelay(10);
-               if (!timeout) {
+               if (timeout < 0) {
                        printf(DRIVERNAME
                                ": timeout waiting for PM restore\n");
                        return;
@@ -500,7 +500,7 @@ static void smc911x_reset(struct eth_device *dev)
        while (timeout-- && smc911x_reg_read(dev, E2P_CMD) & E2P_CMD_EPC_BUSY)
                udelay(10);
 
-       if (!timeout) {
+       if (timeout < 0) {
                printf(DRIVERNAME ": reset timeout\n");
                return;
        }