Skip to content

Commit

Permalink
net: cpmac: fix error handling of cpmac_probe()
Browse files Browse the repository at this point in the history
Add the missing free_netdev() before return from function
cpmac_probe() in the error handling case.
This patch revert commit 0465be8 ("net: cpmac: fix in
releasing resources"), which changed to only free_netdev
while register_netdev failed.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Jul 20, 2016
1 parent 44fafda commit 0971427
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/net/ethernet/ti/cpmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ static int cpmac_probe(struct platform_device *pdev)
mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
if (!mem) {
rc = -ENODEV;
goto out;
goto fail;
}

dev->irq = platform_get_irq_byname(pdev, "irq");
Expand Down Expand Up @@ -1147,7 +1147,7 @@ static int cpmac_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Could not attach to PHY\n");

rc = PTR_ERR(phydev);
goto out;
goto fail;
}

rc = register_netdev(dev);
Expand All @@ -1166,7 +1166,6 @@ static int cpmac_probe(struct platform_device *pdev)

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

Expand Down

0 comments on commit 0971427

Please sign in to comment.