2013-06-18 09:53:19

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] Staging: netlogic: fix missing free_netdev() on error in xlr_net_probe()

From: Wei Yongjun <[email protected]>

Fix missing free_netdev() before return from function xlr_net_probe()
in the devm_ioremap_resource() error handling case.

Signed-off-by: Wei Yongjun <[email protected]>
---
no compile test.
---
drivers/staging/netlogic/xlr_net.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c
index b529d79..2acde54 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -1023,9 +1023,9 @@ static int xlr_net_probe(struct platform_device *pdev)
ndev->base_addr = (unsigned long) devm_ioremap_resource
(&pdev->dev, res);
if (IS_ERR_VALUE(ndev->base_addr)) {
- dev_err(&pdev->dev,
- "devm_ioremap_resource failed\n");
- return ndev->base_addr;
+ dev_err(&pdev->dev, "devm_ioremap_resource failed\n");
+ err = ndev->base_addr;
+ goto err_gmac;
}

res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);


2013-06-18 11:53:31

by Tushar Behera

[permalink] [raw]
Subject: Re: [PATCH -next] Staging: netlogic: fix missing free_netdev() on error in xlr_net_probe()

On 06/18/2013 03:23 PM, Wei Yongjun wrote:
> From: Wei Yongjun <[email protected]>
>
> Fix missing free_netdev() before return from function xlr_net_probe()
> in the devm_ioremap_resource() error handling case.
>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> no compile test.
> ---
> drivers/staging/netlogic/xlr_net.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c
> index b529d79..2acde54 100644
> --- a/drivers/staging/netlogic/xlr_net.c
> +++ b/drivers/staging/netlogic/xlr_net.c
> @@ -1023,9 +1023,9 @@ static int xlr_net_probe(struct platform_device *pdev)
> ndev->base_addr = (unsigned long) devm_ioremap_resource
> (&pdev->dev, res);
> if (IS_ERR_VALUE(ndev->base_addr)) {
> - dev_err(&pdev->dev,
> - "devm_ioremap_resource failed\n");
> - return ndev->base_addr;
> + dev_err(&pdev->dev, "devm_ioremap_resource failed\n");

Please remove this error message too. During review of my patchset, it
was pointed that this error message is redundant. There is already a
similar error message within devm_ioremap_resource call.

> + err = ndev->base_addr;
> + goto err_gmac;
> }
>
> res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>


--
Tushar Behera

2013-06-19 02:30:03

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next v2] Staging: netlogic: fix missing free_netdev() on error in xlr_net_probe()

Fix missing free_netdev() before return from function xlr_net_probe()
in the devm_ioremap_resource() error handling case.

Signed-off-by: Wei Yongjun <[email protected]>
---
v1 -> v2: remove redundant error message.
---
drivers/staging/netlogic/xlr_net.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c
index b529d79..af9e3f1 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -1023,9 +1023,8 @@ static int xlr_net_probe(struct platform_device *pdev)
ndev->base_addr = (unsigned long) devm_ioremap_resource
(&pdev->dev, res);
if (IS_ERR_VALUE(ndev->base_addr)) {
- dev_err(&pdev->dev,
- "devm_ioremap_resource failed\n");
- return ndev->base_addr;
+ err = ndev->base_addr;
+ goto err_gmac;
}

res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);