diff options
author | Giuseppe CAVALLARO <peppe.cavallaro@st.com> | 2013-02-06 15:47:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-10 20:12:10 -0500 |
commit | 3955b22b9798ae8694ac053614694695991f0a91 (patch) | |
tree | a46217f7ea13c2fcb4f9506a91663aadbbc4cb40 | |
parent | de53d55798f44c6c95442ab839004b7272ab61dd (diff) |
stmmac: mdio register has to fail if the phy is not found
With this patch the stmmac fails in case of the phy device
is not found; w/o this fix the mdio can be register twice when
do down/up the iface and this is not correct.
Reported-by: Stas <stsp@list.ru>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 0376a5e6b2bf..0b9829fe3eea 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | |||
@@ -188,8 +188,6 @@ int stmmac_mdio_register(struct net_device *ndev) | |||
188 | goto bus_register_fail; | 188 | goto bus_register_fail; |
189 | } | 189 | } |
190 | 190 | ||
191 | priv->mii = new_bus; | ||
192 | |||
193 | found = 0; | 191 | found = 0; |
194 | for (addr = 0; addr < PHY_MAX_ADDR; addr++) { | 192 | for (addr = 0; addr < PHY_MAX_ADDR; addr++) { |
195 | struct phy_device *phydev = new_bus->phy_map[addr]; | 193 | struct phy_device *phydev = new_bus->phy_map[addr]; |
@@ -237,8 +235,14 @@ int stmmac_mdio_register(struct net_device *ndev) | |||
237 | } | 235 | } |
238 | } | 236 | } |
239 | 237 | ||
240 | if (!found) | 238 | if (!found) { |
241 | pr_warning("%s: No PHY found\n", ndev->name); | 239 | pr_warning("%s: No PHY found\n", ndev->name); |
240 | mdiobus_unregister(new_bus); | ||
241 | mdiobus_free(new_bus); | ||
242 | return -ENODEV; | ||
243 | } | ||
244 | |||
245 | priv->mii = new_bus; | ||
242 | 246 | ||
243 | return 0; | 247 | return 0; |
244 | 248 | ||