[Linux-stm32] [PATCH] net: stmmac: Abort loop after phydev is detected

xiaolinkui xiaolinkui at tj.kylinos.cn
Mon Mar 2 11:34:59 UTC 2020


A mac only needs at most one phydev, There is no need
to recycle the entire list after finding phydev.

Signed-off-by: xiaolinkui <xiaolinkui at tj.kylinos.cn>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index cfe5d8b73142..6fb87cc18d65 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -431,6 +431,9 @@ int stmmac_mdio_register(struct net_device *ndev)
 
 		phy_attached_info(phydev);
 		found = 1;
+
+		if (phydev->phy_id != 0)
+			goto bus_register_done;
 	}
 
 	if (!found && !mdio_node) {
-- 
2.17.1






More information about the Linux-stm32 mailing list