2007-12-02 20:07:12

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 3/3] drivers/serial/uartlite.c: Add missing of_node_put

From: Julia Lawall <[email protected]>

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

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_compatible_node;
@@

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

Signed-off-by: Julia Lawall <[email protected]>
---

diff -u -p a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
--- a/drivers/serial/uartlite.c 2007-11-12 10:35:57.000000000 +0100
+++ b/drivers/serial/uartlite.c 2007-12-02 17:43:57.000000000 +0100
@@ -393,6 +393,7 @@ static inline void __init ulite_console_
continue;

ulite_ports[id].mapbase = res.start;
+ of_node_put(np);
return;
}
}


2007-12-03 15:25:25

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH 3/3] drivers/serial/uartlite.c: Add missing of_node_put

Julia Lawall <julia <at> diku.dk> writes:
> There should be an of_node_put when breaking out of a loop that iterates
> using for_each_compatible_node.
>
<snip>
>
> Signed-off-by: Julia Lawall <julia <at> diku.dk>

Acked-by: Grant Likely <[email protected]>

And this should go in for .24

g.

2007-12-04 15:53:44

by Peter Korsgaard

[permalink] [raw]
Subject: Re: [PATCH 3/3] drivers/serial/uartlite.c: Add missing of_node_put

>>>>> "Julia" == Julia Lawall <[email protected]> writes:

Julia> From: Julia Lawall <[email protected]>
Julia> There should be an of_node_put when breaking out of a loop
Julia> that iterates using for_each_compatible_node.

..

Julia> Signed-off-by: Julia Lawall <[email protected]>

Acked-by: Peter Korsgaard <[email protected]>

--
Bye, Peter Korsgaard