diff options
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/broadcom/genet/bcmmii.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 18961613d385..b56f1bbb17bf 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c | |||
@@ -303,12 +303,12 @@ static int bcmgenet_mii_probe(struct net_device *dev) | |||
303 | /* In the case of a fixed PHY, the DT node associated | 303 | /* In the case of a fixed PHY, the DT node associated |
304 | * to the PHY is the Ethernet MAC DT node. | 304 | * to the PHY is the Ethernet MAC DT node. |
305 | */ | 305 | */ |
306 | if (of_phy_is_fixed_link(dn)) { | 306 | if (!priv->phy_dn && of_phy_is_fixed_link(dn)) { |
307 | ret = of_phy_register_fixed_link(dn); | 307 | ret = of_phy_register_fixed_link(dn); |
308 | if (ret) | 308 | if (ret) |
309 | return ret; | 309 | return ret; |
310 | 310 | ||
311 | priv->phy_dn = dn; | 311 | priv->phy_dn = of_node_get(dn); |
312 | } | 312 | } |
313 | 313 | ||
314 | phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, 0, | 314 | phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, 0, |
@@ -444,6 +444,7 @@ int bcmgenet_mii_init(struct net_device *dev) | |||
444 | return 0; | 444 | return 0; |
445 | 445 | ||
446 | out: | 446 | out: |
447 | of_node_put(priv->phy_dn); | ||
447 | mdiobus_unregister(priv->mii_bus); | 448 | mdiobus_unregister(priv->mii_bus); |
448 | out_free: | 449 | out_free: |
449 | kfree(priv->mii_bus->irq); | 450 | kfree(priv->mii_bus->irq); |
@@ -455,6 +456,7 @@ void bcmgenet_mii_exit(struct net_device *dev) | |||
455 | { | 456 | { |
456 | struct bcmgenet_priv *priv = netdev_priv(dev); | 457 | struct bcmgenet_priv *priv = netdev_priv(dev); |
457 | 458 | ||
459 | of_node_put(priv->phy_dn); | ||
458 | mdiobus_unregister(priv->mii_bus); | 460 | mdiobus_unregister(priv->mii_bus); |
459 | kfree(priv->mii_bus->irq); | 461 | kfree(priv->mii_bus->irq); |
460 | mdiobus_free(priv->mii_bus); | 462 | mdiobus_free(priv->mii_bus); |