net: of_mdio: fix behavior on missing phy device
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Mon, 6 May 2013 23:49:31 +0000 (23:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 May 2013 20:13:29 +0000 (13:13 -0700)
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>
drivers/of/of_mdio.c

index 23049aeca662c7a1944daa127a2fc77c3dcd4410..d5a57a9e329c85de3e48722e8b9576f56dcea577 100644 (file)
@@ -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