net: cpmac: fix in releasing resources
authorVarka Bhadram <varkab@cdac.in>
Thu, 10 Jul 2014 05:35:45 +0000 (11:05 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Jul 2014 07:40:37 +0000 (00:40 -0700)
before registering the the net device this code freeing net device
by using the label 'fail'

fixed by introducing an another label 'out'

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpmac.c

index b6efe3e0f1eef6a54b459e057c63ff5c60be3415..b68c5b5887424f2e9d1cdbb32f6e9a864361e13e 100644 (file)
@@ -1142,7 +1142,7 @@ static int cpmac_probe(struct platform_device *pdev)
        mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
        if (!mem) {
                rc = -ENODEV;
-               goto fail;
+               goto out;
        }
 
        dev->irq = platform_get_irq_byname(pdev, "irq");
@@ -1170,7 +1170,7 @@ static int cpmac_probe(struct platform_device *pdev)
                        dev_err(&pdev->dev, "Could not attach to PHY\n");
 
                rc = PTR_ERR(priv->phy);
-               goto fail;
+               goto out;
        }
 
        rc = register_netdev(dev);
@@ -1189,6 +1189,7 @@ static int cpmac_probe(struct platform_device *pdev)
 
 fail:
        free_netdev(dev);
+out:
        return rc;
 }