Skip to content

Commit

Permalink
net: cpmac: fix in releasing resources
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Varka Bhadram authored and David S. Miller committed Jul 10, 2014
1 parent 55064ef commit 0465be8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/ti/cpmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand All @@ -1189,6 +1189,7 @@ static int cpmac_probe(struct platform_device *pdev)

fail:
free_netdev(dev);
out:
return rc;
}

Expand Down

0 comments on commit 0465be8

Please sign in to comment.