diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-02-02 23:19:50 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-02 23:19:50 -0800 |
commit | ff01b9163655ace76b29b7ff2f56b25c32f795da (patch) | |
tree | cde3ed89cb379d5e74216cff08077a38f2efd8af /drivers | |
parent | 46578a6913e6f5e69229561736b94c18c2e88ae4 (diff) | |
download | lwn-ff01b9163655ace76b29b7ff2f56b25c32f795da.tar.gz lwn-ff01b9163655ace76b29b7ff2f56b25c32f795da.zip |
cassini/sungem: limit reaches -1, but 0 tested
while (limit--)
if (test())
break;
if (limit <= 0)
goto test_failed;
In the last iteration, limit is decremented after the test to 0.
If just thereafter test() succeeds and a break occurs, the goto
still occurs because limit is 0.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/cassini.c | 4 | ||||
-rw-r--r-- | drivers/net/sungem_phy.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 840b3d1a22f5..bbbc3bb08aa5 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -806,7 +806,7 @@ static int cas_reset_mii_phy(struct cas *cp) cas_phy_write(cp, MII_BMCR, BMCR_RESET); udelay(100); - while (limit--) { + while (--limit) { val = cas_phy_read(cp, MII_BMCR); if ((val & BMCR_RESET) == 0) break; @@ -979,7 +979,7 @@ static void cas_phy_init(struct cas *cp) writel(val, cp->regs + REG_PCS_MII_CTRL); limit = STOP_TRIES; - while (limit-- > 0) { + while (--limit > 0) { udelay(10); if ((readl(cp->regs + REG_PCS_MII_CTRL) & PCS_MII_RESET) == 0) diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c index 61843fd57525..78f8cee5fd74 100644 --- a/drivers/net/sungem_phy.c +++ b/drivers/net/sungem_phy.c @@ -79,7 +79,7 @@ static int reset_one_mii_phy(struct mii_phy* phy, int phy_id) udelay(100); - while (limit--) { + while (--limit) { val = __phy_read(phy, phy_id, MII_BMCR); if ((val & BMCR_RESET) == 0) break; |