Commit 09714275 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

net: cpmac: fix error handling of cpmac_probe()

Add the missing free_netdev() before return from function
cpmac_probe() in the error handling case.
This patch revert commit 0465be8f ("net: cpmac: fix in
releasing resources"), which changed to only free_netdev
while register_netdev failed.
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44fafdaa
...@@ -1119,7 +1119,7 @@ static int cpmac_probe(struct platform_device *pdev) ...@@ -1119,7 +1119,7 @@ static int cpmac_probe(struct platform_device *pdev)
mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
if (!mem) { if (!mem) {
rc = -ENODEV; rc = -ENODEV;
goto out; goto fail;
} }
dev->irq = platform_get_irq_byname(pdev, "irq"); dev->irq = platform_get_irq_byname(pdev, "irq");
...@@ -1147,7 +1147,7 @@ static int cpmac_probe(struct platform_device *pdev) ...@@ -1147,7 +1147,7 @@ static int cpmac_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Could not attach to PHY\n"); dev_err(&pdev->dev, "Could not attach to PHY\n");
rc = PTR_ERR(phydev); rc = PTR_ERR(phydev);
goto out; goto fail;
} }
rc = register_netdev(dev); rc = register_netdev(dev);
...@@ -1166,7 +1166,6 @@ static int cpmac_probe(struct platform_device *pdev) ...@@ -1166,7 +1166,6 @@ static int cpmac_probe(struct platform_device *pdev)
fail: fail:
free_netdev(dev); free_netdev(dev);
out:
return rc; return rc;
} }
......
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