netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] net: cpmac: fix error handling of cpmac_probe()
@ 2016-07-19 12:37 Wei Yongjun
  2016-07-20 21:48 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2016-07-19 12:37 UTC (permalink / raw)
  To: Florian Fainelli, Varka Bhadram; +Cc: Wei Yongjun, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Add the missing free_netdev() before return from function
cpmac_probe() in the error handling case.
This patch revert commit 0465be8f4f1d ("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>
---
 drivers/net/ethernet/ti/cpmac.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index f86497c..cecfdaa 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1117,7 +1117,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");
@@ -1145,7 +1145,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);
@@ -1164,7 +1164,6 @@ static int cpmac_probe(struct platform_device *pdev)
 
 fail:
 	free_netdev(dev);
-out:
 	return rc;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-20 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 12:37 [PATCH -next] net: cpmac: fix error handling of cpmac_probe() Wei Yongjun
2016-07-20 21:48 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).