net: bcmgenet: Utilize bcmgenet_mii_exit() for error path
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 31 Jul 2017 19:04:28 +0000 (12:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Jul 2017 21:40:58 +0000 (14:40 -0700)
bcmgenet_mii_init() has an error path which is strictly identical to the
unwinding that bcmgenet_mii_exit() does, so have bcmgenet_mii_init()
utilize bcmgenet_mii_exit() for that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmmii.c

index 7fdc352628f9c7c6265a973349128a65f9e744e1..33d3f60ac74bb6cf2a94181ac8ec12d5e0870b12 100644 (file)
@@ -563,7 +563,6 @@ static int bcmgenet_mii_bus_init(struct bcmgenet_priv *priv)
 int bcmgenet_mii_init(struct net_device *dev)
 {
        struct bcmgenet_priv *priv = netdev_priv(dev);
-       struct device_node *dn = priv->pdev->dev.of_node;
        int ret;
 
        ret = bcmgenet_mii_register(priv);
@@ -577,11 +576,7 @@ int bcmgenet_mii_init(struct net_device *dev)
        return 0;
 
 out:
-       if (of_phy_is_fixed_link(dn))
-               of_phy_deregister_fixed_link(dn);
-       of_node_put(priv->phy_dn);
-       platform_device_unregister(priv->mii_pdev);
-       platform_device_put(priv->mii_pdev);
+       bcmgenet_mii_exit(dev);
        return ret;
 }