diff mbox

[net,v2,7/7] net: cpmac: fix in releasing resources

Message ID 1404970545-26508-8-git-send-email-varkabhadram@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Varka Bhadram July 10, 2014, 5:35 a.m. UTC
From: Varka Bhadram <varkab@cdac.in>

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>
---
 drivers/net/ethernet/ti/cpmac.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Felipe Balbi July 10, 2014, 1:11 p.m. UTC | #1
On Thu, Jul 10, 2014 at 11:05:45AM +0530, varkabhadram@gmail.com wrote:
> From: Varka Bhadram <varkab@cdac.in>
> 
> before registering the the net device this code freeing net device

remove one 'the'

> by using the label 'fail'
> 
> fixed by introducing an another label 'out'
> 
> Signed-off-by: Varka Bhadram <varkab@cdac.in>
> ---
>  drivers/net/ethernet/ti/cpmac.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
> index b6efe3e..b68c5b5 100644
> --- a/drivers/net/ethernet/ti/cpmac.c
> +++ b/drivers/net/ethernet/ti/cpmac.c
> @@ -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:

this will leak 'dev'.

>  	return rc;
>  }
>  
> -- 
> 1.7.9.5
>
diff mbox

Patch

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index b6efe3e..b68c5b5 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -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;
 }