1
linux/arch/powerpc/platforms/chrp
Julia Lawall 7cf9bac559 powerpc/chrp/nvram.c: Add of_node_put to avoid memory leak
Add a call to of_node_put in the error handling code following a call to
of_find_node_by_type.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
local idexpression x;
expression E,E1,E2;
statement S;
@@

*x =
(of_find_node_by_path
|of_find_node_by_name
|of_find_node_by_phandle
|of_get_parent
|of_get_next_parent
|of_get_next_child
|of_find_compatible_node
|of_match_node
|of_find_node_by_type
|of_find_node_with_property
|of_find_matching_node
|of_parse_phandle
)(...);
...
if (x == NULL) S
<... when != x = E
*if (...) {
  ... when != of_node_put(x)
      when != if (...) { ... of_node_put(x); ... }
(
  return <+...x...+>;
|
*  return ...;
)
}
...>
(
E2 = x;
|
of_node_put(x);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2010-09-02 14:07:34 +10:00
..
chrp.h
gg2.h
Kconfig powerpc/chrp: Use the same RTAS daemon as pSeries 2009-10-30 17:20:53 +11:00
Makefile
nvram.c powerpc/chrp/nvram.c: Add of_node_put to avoid memory leak 2010-09-02 14:07:34 +10:00
pci.c powerpc/pci: Clean up direct access to sysdata by CHRP platforms 2009-05-21 15:44:23 +10:00
pegasos_eth.c powerpc: Disable mv643xx Ethernet port 0 on Pegasos 2009-02-11 16:00:08 +11:00
setup.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
smp.c powerpc: Use one common impl. of RTAS timebase sync and use raw spinlock 2009-06-26 16:55:25 +10:00
time.c powerpc: Use bcd2bin/bin2bcd 2008-08-20 16:34:58 +10:00