linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] arch/sparc: Add missing of_node_put
@ 2007-12-02 20:05 Julia Lawall
  2007-12-04  8:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2007-12-02 20:05 UTC (permalink / raw)
  To: wli, davem, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

There should be an of_node_put when breaking out of a loop that iterates
using for_each_node_by_type.

This was detected and fixed using the following semantic patch.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
identifier d;
type T;
expression e;
iterator for_each_node_by_type;
@@

T *d;
...
for_each_node_by_type(d,...)
  {... when != of_node_put(d)
       when != e = d
(
   return d;
|
+  of_node_put(d);
?  return ...;
)
...}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
---

diff -u -p a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
--- a/arch/sparc/kernel/devices.c	2006-11-30 19:04:17.000000000 +0100
+++ b/arch/sparc/kernel/devices.c	2007-12-02 17:57:39.000000000 +0100
@@ -62,8 +62,10 @@ static int __cpu_find_by(int (*compare)(
 		int err = check_cpu_node(dp->node, &cur_inst,
 					 compare, compare_arg,
 					 prom_node, mid);
-		if (!err)
+		if (!err) {			 
+			of_node_put(dp);
 			return 0;
+		}
 	}
 
 	return -ENODEV;

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

* Re: [PATCH 2/3] arch/sparc: Add missing of_node_put
  2007-12-02 20:05 [PATCH 2/3] arch/sparc: Add missing of_node_put Julia Lawall
@ 2007-12-04  8:33 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-12-04  8:33 UTC (permalink / raw)
  To: julia; +Cc: wli, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>
Date: Sun, 2 Dec 2007 21:05:24 +0100 (CET)

> From: Julia Lawall <julia@diku.dk>
> 
> There should be an of_node_put when breaking out of a loop that iterates
> using for_each_node_by_type.
> 
> This was detected and fixed using the following semantic patch.
> (http://www.emn.fr/x-info/coccinelle/)
> 
> // <smpl>
> @@
> identifier d;
> type T;
> expression e;
> iterator for_each_node_by_type;
> @@
> 
> T *d;
> ...
> for_each_node_by_type(d,...)
>   {... when != of_node_put(d)
>        when != e = d
> (
>    return d;
> |
> +  of_node_put(d);
> ?  return ...;
> )
> ...}
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>

Applied, but I had to fixup the trailing whitespace on this line:

> -		if (!err)
> +		if (!err) {			 

As indicated by GIT:

Adds trailing whitespace.
diff:9:		if (!err) {			 
warning: 1 line adds whitespace errors.

Please correct these kinds of errors before submitting in
the future, thanks.

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

end of thread, other threads:[~2007-12-04  8:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-02 20:05 [PATCH 2/3] arch/sparc: Add missing of_node_put Julia Lawall
2007-12-04  8:33 ` 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).