summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2017-08-08 11:52:32 +0200
committerDavid S. Miller <davem@davemloft.net>2017-08-09 06:07:41 +0200
commit51ce3e2145cc3927c9551b8c3623610114b41651 (patch)
tree6bf316536e4f3653559f89c81c040028a0748cba
parentcxgb4: Clear On FLASH config file after a FW upgrade (diff)
downloadlinux-51ce3e2145cc3927c9551b8c3623610114b41651.tar.xz
linux-51ce3e2145cc3927c9551b8c3623610114b41651.zip
net: phy: mdio-bcm-unimac: fix unsigned wrap-around when decrementing timeout
Change post-decrement compare to pre-decrement to avoid an unsigned integer wrap-around on timeout. This leads to the following !timeout check to never to be true so -ETIMEDOUT is never returned. Detected by CoverityScan, CID#1452623 ("Logically dead code") Fixes: 69a60b0579a4 ("net: phy: mdio-bcm-unimac: factor busy polling loop") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/mdio-bcm-unimac.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c
index 89425ca48412..73c5267a11fd 100644
--- a/drivers/net/phy/mdio-bcm-unimac.c
+++ b/drivers/net/phy/mdio-bcm-unimac.c
@@ -71,7 +71,7 @@ static int unimac_mdio_poll(void *wait_func_data)
return 0;
usleep_range(1000, 2000);
- } while (timeout--);
+ } while (--timeout);
if (!timeout)
return -ETIMEDOUT;