Skip to content

Commit 058112c

Browse files
shesselbadavem330
authored andcommitted
net: of_mdio: fix behavior on missing phy device
of_mdiobus_register creates a phy_device even if get_phy_device failed to create it previously. This causes indefinite polling on non-existent PHYs. This fix makes of_mdio_register rely on get_phy_device to properly create the device or fail otherwise. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7b0c5f2 commit 058112c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/of/of_mdio.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
8484
phy = get_phy_device(mdio, addr, is_c45);
8585

8686
if (!phy || IS_ERR(phy)) {
87-
phy = phy_device_create(mdio, addr, 0, false, NULL);
88-
if (!phy || IS_ERR(phy)) {
89-
dev_err(&mdio->dev,
90-
"error creating PHY at address %i\n",
91-
addr);
92-
continue;
93-
}
87+
dev_err(&mdio->dev,
88+
"cannot get PHY at address %i\n",
89+
addr);
90+
continue;
9491
}
9592

9693
/* Associate the OF node with the device structure so it

0 commit comments

Comments
 (0)