Skip to content

Commit

Permalink
net: of_mdio: fix behavior on missing phy device
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
shesselba authored and davem330 committed May 8, 2013
1 parent 7b0c5f2 commit 058112c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/of/of_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
phy = get_phy_device(mdio, addr, is_c45);

if (!phy || IS_ERR(phy)) {
phy = phy_device_create(mdio, addr, 0, false, NULL);
if (!phy || IS_ERR(phy)) {
dev_err(&mdio->dev,
"error creating PHY at address %i\n",
addr);
continue;
}
dev_err(&mdio->dev,
"cannot get PHY at address %i\n",
addr);
continue;
}

/* Associate the OF node with the device structure so it
Expand Down

0 comments on commit 058112c

Please sign in to comment.