* [PATCH 7/14] cpu: delete unneeded test before of_node_put
@ 2014-08-08 10:07 Julia Lawall
2014-08-11 2:56 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2014-08-08 10:07 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: kernel-janitors, linux-kernel, Paul Mackerras,
Uwe Kleine-König, linuxppc-dev
From: Julia Lawall <Julia.Lawall@lip6.fr>
Simplify the error path to avoid calling of_node_put when it is not needed.
The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
-if (e)
of_node_put(e);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
arch/powerpc/sysdev/ppc4xx_cpm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/sysdev/ppc4xx_cpm.c b/arch/powerpc/sysdev/ppc4xx_cpm.c
index 82e2cfe..ba95adf 100644
--- a/arch/powerpc/sysdev/ppc4xx_cpm.c
+++ b/arch/powerpc/sysdev/ppc4xx_cpm.c
@@ -281,7 +281,7 @@ static int __init cpm_init(void)
printk(KERN_ERR "cpm: could not parse dcr property for %s\n",
np->full_name);
ret = -EINVAL;
- goto out;
+ goto node_put;
}
cpm.dcr_host = dcr_map(np, dcr_base, dcr_len);
@@ -290,7 +290,7 @@ static int __init cpm_init(void)
printk(KERN_ERR "cpm: failed to map dcr property for %s\n",
np->full_name);
ret = -EINVAL;
- goto out;
+ goto node_put;
}
/* All 4xx SoCs with a CPM controller have one of two
@@ -330,9 +330,9 @@ static int __init cpm_init(void)
if (cpm.standby || cpm.suspend)
suspend_set_ops(&cpm_suspend_ops);
+node_put:
+ of_node_put(np);
out:
- if (np)
- of_node_put(np);
return ret;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 7/14] cpu: delete unneeded test before of_node_put
2014-08-08 10:07 [PATCH 7/14] cpu: delete unneeded test before of_node_put Julia Lawall
@ 2014-08-11 2:56 ` Benjamin Herrenschmidt
2014-08-11 7:56 ` [PATCH 7/14 v2] powerpc/4xx/cpm: " Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2014-08-11 2:56 UTC (permalink / raw)
To: Julia Lawall
Cc: kernel-janitors, linux-kernel, Paul Mackerras,
Uwe Kleine-König, linuxppc-dev
On Fri, 2014-08-08 at 12:07 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Simplify the error path to avoid calling of_node_put when it is not needed.
>
> The semantic patch that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
Change the subject to powerpc/4xx/cpm or something like that,
appart from that:
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> // <smpl>
> @@
> expression e;
> @@
>
> -if (e)
> of_node_put(e);
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> arch/powerpc/sysdev/ppc4xx_cpm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/ppc4xx_cpm.c b/arch/powerpc/sysdev/ppc4xx_cpm.c
> index 82e2cfe..ba95adf 100644
> --- a/arch/powerpc/sysdev/ppc4xx_cpm.c
> +++ b/arch/powerpc/sysdev/ppc4xx_cpm.c
> @@ -281,7 +281,7 @@ static int __init cpm_init(void)
> printk(KERN_ERR "cpm: could not parse dcr property for %s\n",
> np->full_name);
> ret = -EINVAL;
> - goto out;
> + goto node_put;
> }
>
> cpm.dcr_host = dcr_map(np, dcr_base, dcr_len);
> @@ -290,7 +290,7 @@ static int __init cpm_init(void)
> printk(KERN_ERR "cpm: failed to map dcr property for %s\n",
> np->full_name);
> ret = -EINVAL;
> - goto out;
> + goto node_put;
> }
>
> /* All 4xx SoCs with a CPM controller have one of two
> @@ -330,9 +330,9 @@ static int __init cpm_init(void)
>
> if (cpm.standby || cpm.suspend)
> suspend_set_ops(&cpm_suspend_ops);
> +node_put:
> + of_node_put(np);
> out:
> - if (np)
> - of_node_put(np);
> return ret;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 7/14 v2] powerpc/4xx/cpm: delete unneeded test before of_node_put
2014-08-11 2:56 ` Benjamin Herrenschmidt
@ 2014-08-11 7:56 ` Julia Lawall
0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2014-08-11 7:56 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: kernel-janitors, linux-kernel, Paul Mackerras,
Uwe Kleine-König, linuxppc-dev
From: Julia Lawall <Julia.Lawall@lip6.fr>
Simplify the error path to avoid calling of_node_put when it is not needed.
The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
-if (e)
of_node_put(e);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
v2: new subject
arch/powerpc/sysdev/ppc4xx_cpm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/sysdev/ppc4xx_cpm.c b/arch/powerpc/sysdev/ppc4xx_cpm.c
index 82e2cfe..ba95adf 100644
--- a/arch/powerpc/sysdev/ppc4xx_cpm.c
+++ b/arch/powerpc/sysdev/ppc4xx_cpm.c
@@ -281,7 +281,7 @@ static int __init cpm_init(void)
printk(KERN_ERR "cpm: could not parse dcr property for %s\n",
np->full_name);
ret = -EINVAL;
- goto out;
+ goto node_put;
}
cpm.dcr_host = dcr_map(np, dcr_base, dcr_len);
@@ -290,7 +290,7 @@ static int __init cpm_init(void)
printk(KERN_ERR "cpm: failed to map dcr property for %s\n",
np->full_name);
ret = -EINVAL;
- goto out;
+ goto node_put;
}
/* All 4xx SoCs with a CPM controller have one of two
@@ -330,9 +330,9 @@ static int __init cpm_init(void)
if (cpm.standby || cpm.suspend)
suspend_set_ops(&cpm_suspend_ops);
+node_put:
+ of_node_put(np);
out:
- if (np)
- of_node_put(np);
return ret;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-11 7:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-08 10:07 [PATCH 7/14] cpu: delete unneeded test before of_node_put Julia Lawall
2014-08-11 2:56 ` Benjamin Herrenschmidt
2014-08-11 7:56 ` [PATCH 7/14 v2] powerpc/4xx/cpm: " Julia Lawall
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).