Commit 141f575f authored by David S. Miller's avatar David S. Miller

Merge branch 'macb-next'

Michael Grzeschik says:

====================
net: macb: add error handling on probe and

This series adds more error handling to the macb driver.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e5c500eb 66ee6a06
...@@ -611,6 +611,9 @@ static int macb_mii_init(struct macb *bp) ...@@ -611,6 +611,9 @@ static int macb_mii_init(struct macb *bp)
err_out_unregister_bus: err_out_unregister_bus:
mdiobus_unregister(bp->mii_bus); mdiobus_unregister(bp->mii_bus);
err_out_free_mdiobus: err_out_free_mdiobus:
of_node_put(bp->phy_node);
if (np && of_phy_is_fixed_link(np))
of_phy_deregister_fixed_link(np);
mdiobus_free(bp->mii_bus); mdiobus_free(bp->mii_bus);
err_out: err_out:
return err; return err;
...@@ -3550,6 +3553,9 @@ static int macb_probe(struct platform_device *pdev) ...@@ -3550,6 +3553,9 @@ static int macb_probe(struct platform_device *pdev)
err_out_unregister_mdio: err_out_unregister_mdio:
phy_disconnect(dev->phydev); phy_disconnect(dev->phydev);
mdiobus_unregister(bp->mii_bus); mdiobus_unregister(bp->mii_bus);
of_node_put(bp->phy_node);
if (np && of_phy_is_fixed_link(np))
of_phy_deregister_fixed_link(np);
mdiobus_free(bp->mii_bus); mdiobus_free(bp->mii_bus);
/* Shutdown the PHY if there is a GPIO reset */ /* Shutdown the PHY if there is a GPIO reset */
...@@ -3572,6 +3578,7 @@ static int macb_remove(struct platform_device *pdev) ...@@ -3572,6 +3578,7 @@ static int macb_remove(struct platform_device *pdev)
{ {
struct net_device *dev; struct net_device *dev;
struct macb *bp; struct macb *bp;
struct device_node *np = pdev->dev.of_node;
dev = platform_get_drvdata(pdev); dev = platform_get_drvdata(pdev);
...@@ -3580,6 +3587,8 @@ static int macb_remove(struct platform_device *pdev) ...@@ -3580,6 +3587,8 @@ static int macb_remove(struct platform_device *pdev)
if (dev->phydev) if (dev->phydev)
phy_disconnect(dev->phydev); phy_disconnect(dev->phydev);
mdiobus_unregister(bp->mii_bus); mdiobus_unregister(bp->mii_bus);
if (np && of_phy_is_fixed_link(np))
of_phy_deregister_fixed_link(np);
dev->phydev = NULL; dev->phydev = NULL;
mdiobus_free(bp->mii_bus); mdiobus_free(bp->mii_bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment