diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-03-04 03:11:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-04 03:11:42 -0500 |
commit | 858b9ced6e73a0f087294c398a1ae70a7eeed94f (patch) | |
tree | 81a2298b2c45d90f68b016fb0b4fa05c19a787f5 /drivers/net | |
parent | 4222474519ff5b31a526dfa1da7aa4b0e38bef5c (diff) |
net: more timeouts that reach -1
with while (timeout-- > 0); timeout reaches -1 after the loop, so the tests
below are off by one. also don't do an '< 0' test on an unsigned.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/arm/ks8695net.c | 2 | ||||
-rw-r--r-- | drivers/net/jme.c | 3 | ||||
-rw-r--r-- | drivers/net/ucc_geth_mii.c | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c index 1cf2f949c0b4..f3a127434897 100644 --- a/drivers/net/arm/ks8695net.c +++ b/drivers/net/arm/ks8695net.c | |||
@@ -560,7 +560,7 @@ ks8695_reset(struct ks8695_priv *ksp) | |||
560 | msleep(1); | 560 | msleep(1); |
561 | } | 561 | } |
562 | 562 | ||
563 | if (reset_timeout == 0) { | 563 | if (reset_timeout < 0) { |
564 | dev_crit(ksp->dev, | 564 | dev_crit(ksp->dev, |
565 | "Timeout waiting for DMA engines to reset\n"); | 565 | "Timeout waiting for DMA engines to reset\n"); |
566 | /* And blithely carry on */ | 566 | /* And blithely carry on */ |
diff --git a/drivers/net/jme.c b/drivers/net/jme.c index 08b34051c646..a6e1a35a13cb 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c | |||
@@ -957,13 +957,14 @@ jme_process_receive(struct jme_adapter *jme, int limit) | |||
957 | goto out_inc; | 957 | goto out_inc; |
958 | 958 | ||
959 | i = atomic_read(&rxring->next_to_clean); | 959 | i = atomic_read(&rxring->next_to_clean); |
960 | while (limit-- > 0) { | 960 | while (limit > 0) { |
961 | rxdesc = rxring->desc; | 961 | rxdesc = rxring->desc; |
962 | rxdesc += i; | 962 | rxdesc += i; |
963 | 963 | ||
964 | if ((rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_OWN)) || | 964 | if ((rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_OWN)) || |
965 | !(rxdesc->descwb.desccnt & RXWBDCNT_WBCPL)) | 965 | !(rxdesc->descwb.desccnt & RXWBDCNT_WBCPL)) |
966 | goto out; | 966 | goto out; |
967 | --limit; | ||
967 | 968 | ||
968 | desccnt = rxdesc->descwb.desccnt & RXWBDCNT_DCNT; | 969 | desccnt = rxdesc->descwb.desccnt & RXWBDCNT_DCNT; |
969 | 970 | ||
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index 54635911305c..0ada4edd56eb 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c | |||
@@ -107,7 +107,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | |||
107 | static int uec_mdio_reset(struct mii_bus *bus) | 107 | static int uec_mdio_reset(struct mii_bus *bus) |
108 | { | 108 | { |
109 | struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv; | 109 | struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv; |
110 | unsigned int timeout = PHY_INIT_TIMEOUT; | 110 | int timeout = PHY_INIT_TIMEOUT; |
111 | 111 | ||
112 | mutex_lock(&bus->mdio_lock); | 112 | mutex_lock(&bus->mdio_lock); |
113 | 113 | ||
@@ -123,7 +123,7 @@ static int uec_mdio_reset(struct mii_bus *bus) | |||
123 | 123 | ||
124 | mutex_unlock(&bus->mdio_lock); | 124 | mutex_unlock(&bus->mdio_lock); |
125 | 125 | ||
126 | if (timeout <= 0) { | 126 | if (timeout < 0) { |
127 | printk(KERN_ERR "%s: The MII Bus is stuck!\n", bus->name); | 127 | printk(KERN_ERR "%s: The MII Bus is stuck!\n", bus->name); |
128 | return -EBUSY; | 128 | return -EBUSY; |
129 | } | 129 | } |