linux/arch/powerpc/sysdev/qe_lib
Julia Lawall 5aac4d73dc arch/powerpc/sysdev/qe_lib/qe.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_compatible_node.

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

// <smpl>
@r exists@
local idexpression x;
expression E,E1;
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
)(...);
...
if (x == NULL) S
<... when != x = E
*if (...) {
  ... when != of_node_put(x)
      when != if (...) { ... of_node_put(x); ... }
(
  return <+...x...+>;
|
*  return ...;
)
}
...>
of_node_put(x);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-08-31 16:41:03 -05:00
..
gpio.c of/gpio: add default of_xlate function if device has a node pointer 2010-07-05 16:14:30 -06:00
Kconfig powerpc/qe: Select QE_USB with USB_GADGET_FSL_QE 2008-12-30 12:12:12 -06:00
Makefile powerpc/QE: implement support for the GPIO LIB API 2008-06-10 11:11:10 -05:00
qe_ic.c powerpc/qe: Convert qe_ic_lock to raw_spinlock 2010-03-04 10:42:58 -06:00
qe_ic.h [POWERPC] Add an optional device_node pointer to the irq_host 2007-09-14 01:33:20 +10:00
qe_io.c powerpc: Remove trailing space in messages 2010-02-09 13:56:23 +11:00
qe.c arch/powerpc/sysdev/qe_lib/qe.c: Add of_node_put to avoid memory leak 2010-08-31 16:41:03 -05:00
ucc_fast.c powerpc: fix memory leaks in QE library 2008-08-20 23:58:12 -05:00
ucc_slow.c powerpc: fix memory leaks in QE library 2008-08-20 23:58:12 -05:00
ucc.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
usb.c powerpc/QE: add support for QE USB clocks routing 2008-06-10 10:39:13 -05:00