kernel-ark/arch/powerpc/sysdev/qe_lib
Julia Lawall 3475dd8a68 powerpc/qe: introduce missing kfree
Error handling code following a kzalloc should free the allocated data.

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

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@

x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...x...+> }
(
x->f1 = E
|
 (x->f1 == NULL || ...)
|
 f(...,x->f1,...)
)
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </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>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2009-08-20 10:27:38 +10:00
..
gpio.c powerpc/qe: Implement QE Pin Multiplexing API 2008-12-30 11:13:43 -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: introduce missing kfree 2009-08-20 10:27:38 +10:00
qe_ic.h
qe_io.c powerpc/QE: prepare QE PIO code for GPIO LIB support 2008-06-10 10:39:18 -05:00
qe.c powerpc/qe: add polling timeout to qe_issue_cmd() 2009-06-23 08:09:41 -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 powerpc/qe: Move cmxgcr_lock definition from the ucc.c into the qe.c 2008-12-03 10:47:36 -06:00
usb.c powerpc/QE: add support for QE USB clocks routing 2008-06-10 10:39:13 -05:00