diff options
Diffstat (limited to 'drivers/net/phy/mdio_bus.c')
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index fc2f0e695a13..c30196d0ad16 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -91,9 +91,12 @@ int mdiobus_register(struct mii_bus *bus) | |||
91 | 91 | ||
92 | err = device_register(&phydev->dev); | 92 | err = device_register(&phydev->dev); |
93 | 93 | ||
94 | if (err) | 94 | if (err) { |
95 | printk(KERN_ERR "phy %d failed to register\n", | 95 | printk(KERN_ERR "phy %d failed to register\n", |
96 | i); | 96 | i); |
97 | phy_device_free(phydev); | ||
98 | phydev = NULL; | ||
99 | } | ||
97 | } | 100 | } |
98 | 101 | ||
99 | bus->phy_map[i] = phydev; | 102 | bus->phy_map[i] = phydev; |
@@ -110,10 +113,8 @@ void mdiobus_unregister(struct mii_bus *bus) | |||
110 | int i; | 113 | int i; |
111 | 114 | ||
112 | for (i = 0; i < PHY_MAX_ADDR; i++) { | 115 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
113 | if (bus->phy_map[i]) { | 116 | if (bus->phy_map[i]) |
114 | device_unregister(&bus->phy_map[i]->dev); | 117 | device_unregister(&bus->phy_map[i]->dev); |
115 | kfree(bus->phy_map[i]); | ||
116 | } | ||
117 | } | 118 | } |
118 | } | 119 | } |
119 | EXPORT_SYMBOL(mdiobus_unregister); | 120 | EXPORT_SYMBOL(mdiobus_unregister); |