Commit 058112c7 authored by Sebastian Hesselbarth's avatar Sebastian Hesselbarth Committed by David S. Miller

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: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7b0c5f21
...@@ -84,13 +84,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) ...@@ -84,13 +84,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
phy = get_phy_device(mdio, addr, is_c45); phy = get_phy_device(mdio, addr, is_c45);
if (!phy || IS_ERR(phy)) { if (!phy || IS_ERR(phy)) {
phy = phy_device_create(mdio, addr, 0, false, NULL); dev_err(&mdio->dev,
if (!phy || IS_ERR(phy)) { "cannot get PHY at address %i\n",
dev_err(&mdio->dev, addr);
"error creating PHY at address %i\n", continue;
addr);
continue;
}
} }
/* Associate the OF node with the device structure so it /* Associate the OF node with the device structure so it
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment