[PATCH] net: phy: mdio-bcm-unimac: remove redundant !timeout check

Subsystems: ethernet phy library, networking drivers, the rest

STALE2696d

3 messages, 3 authors, 2019-03-27 · open the first message on its own page

[PATCH] net: phy: mdio-bcm-unimac: remove redundant !timeout check

From: Colin King <hidden>
Date: 2019-03-27 16:15:28

From: Colin Ian King <redacted>

The check for zero timeout is always true at the end of the proceeding
while loop; the only other exit path in the loop is if the unimac MDIO
is not busy.  Remove the redundant zero timeout check and always
return -ETIMEDOUT on this timeout return path.

Signed-off-by: Colin Ian King <redacted>
---
 drivers/net/phy/mdio-bcm-unimac.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c
index 3a592629dc7e..4a28fb29adaa 100644
--- a/drivers/net/phy/mdio-bcm-unimac.c
+++ b/drivers/net/phy/mdio-bcm-unimac.c
@@ -92,10 +92,7 @@ static int unimac_mdio_poll(void *wait_func_data)
 		usleep_range(1000, 2000);
 	} while (--timeout);
 
-	if (!timeout)
-		return -ETIMEDOUT;
-
-	return 0;
+	return -ETIMEDOUT;
 }
 
 static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
-- 
2.20.1

Re: [PATCH] net: phy: mdio-bcm-unimac: remove redundant !timeout check

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2019-03-27 16:21:37

On 3/27/19 9:15 AM, Colin King wrote:
From: Colin Ian King <redacted>

The check for zero timeout is always true at the end of the proceeding
while loop; the only other exit path in the loop is if the unimac MDIO
is not busy.  Remove the redundant zero timeout check and always
return -ETIMEDOUT on this timeout return path.

Signed-off-by: Colin Ian King <redacted>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

Re: [PATCH] net: phy: mdio-bcm-unimac: remove redundant !timeout check

From: David Miller <davem@davemloft.net>
Date: 2019-03-27 21:27:52

From: Colin King <redacted>
Date: Wed, 27 Mar 2019 16:15:20 +0000
From: Colin Ian King <redacted>

The check for zero timeout is always true at the end of the proceeding
while loop; the only other exit path in the loop is if the unimac MDIO
is not busy.  Remove the redundant zero timeout check and always
return -ETIMEDOUT on this timeout return path.

Signed-off-by: Colin Ian King <redacted>
Applied to net-next.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help