diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2013-05-06 19:49:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-08 16:13:29 -0400 |
commit | 058112c7efc9ef43bb511c137293dddbe6e42908 (patch) | |
tree | c3c00dafaeaa95f78a3296f2cbd58bba92dd6613 | |
parent | 7b0c5f21f348a66de495868b8df0284e8dfd6bbf (diff) |
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>
-rw-r--r-- | drivers/of/of_mdio.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 23049aeca662..d5a57a9e329c 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -84,13 +84,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
84 | phy = get_phy_device(mdio, addr, is_c45); | 84 | phy = get_phy_device(mdio, addr, is_c45); |
85 | 85 | ||
86 | if (!phy || IS_ERR(phy)) { | 86 | if (!phy || IS_ERR(phy)) { |
87 | phy = phy_device_create(mdio, addr, 0, false, NULL); | 87 | dev_err(&mdio->dev, |
88 | if (!phy || IS_ERR(phy)) { | 88 | "cannot get PHY at address %i\n", |
89 | dev_err(&mdio->dev, | 89 | addr); |
90 | "error creating PHY at address %i\n", | 90 | continue; |
91 | addr); | ||
92 | continue; | ||
93 | } | ||
94 | } | 91 | } |
95 | 92 | ||
96 | /* Associate the OF node with the device structure so it | 93 | /* Associate the OF node with the device structure so it |