kernel_optimize_test/arch/powerpc/platforms/chrp
Nicolas Palix 29e931c02b powerpc/chrp: Add missing of_node_put in pci.c
of_node_put is needed before discarding a value received from
of_find_node_by_name, eg in error handling code or when the device
node is no longer used.

The semantic match that catches the bug is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression struct device_node *n;
position p1, p2;
statement S1,S2;
expression E,E1;
expression *ptr != NULL;
@@

(
if (!(n@p1 = of_find_node_by_name(...))) S1
|
n@p1 = of_find_node_by_name(...)
)
<... when != of_node_put(n)
    when != if (...) { <+... of_node_put(n) ...+> }
    when != true !n  || ...
    when != n = E
    when != E = n
if (!n || ...) S2
...>
(
  return \(0\|<+...n...+>\|ptr\);
|
return@p2 ...;
|
n = E1
|
E1 = n
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s of_find_node_by_name %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Nicolas Palix <npalix@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-12-16 14:39:32 +11:00
..
chrp.h
gg2.h [POWERPC] Copy over headers from arch/ppc to arch/powerpc that we need 2007-08-22 22:43:29 -05:00
Kconfig [POWERPC] disallow building powermac and tsi108 without PCI 2007-06-29 01:57:00 -05:00
Makefile [POWERPC] disallow building powermac and tsi108 without PCI 2007-06-29 01:57:00 -05:00
nvram.c
pci.c powerpc/chrp: Add missing of_node_put in pci.c 2008-12-16 14:39:32 +11:00
pegasos_eth.c mv643xx_eth: get rid of static variables, allow multiple instances 2008-04-28 21:17:07 -07:00
setup.c Remove asm/a.out.h files for all architectures without a.out support. 2008-09-06 19:30:24 +01:00
smp.c [POWERPC] Remove old includes from arch/ppc 2007-08-22 22:39:35 -05:00
time.c powerpc: Use bcd2bin/bin2bcd 2008-08-20 16:34:58 +10:00