android_kernel_motorola_sm6225/drivers/tty/serial
Julia Lawall 48a10cdfc0 drivers/serial/ucc_uart.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 or of_find_node_by_type.

This patch also substantially reorganizes the error handling code in the
function, to that it is possible first to jump to code that frees qe_port
and then to jump to code that also puts np.

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>
Acked-by: Timur Tabi <timur@freescale.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2011-03-15 13:48:16 -05:00
..
cpm_uart
jsm
8250.c
8250.h
8250_accent.c
8250_acorn.c
8250_boca.c
8250_early.c
8250_exar_st16c554.c
8250_fourport.c
8250_gsc.c
8250_hp300.c
8250_hub6.c
8250_mca.c
8250_pci.c
8250_pnp.c
21285.c
68328serial.c m68knommu: fix dereference of port.tty 2011-02-16 09:43:18 +10:00
68328serial.h
68360serial.c 68360serial: Plumb in rs_360_get_icount() 2011-02-03 14:44:23 -08:00
altera_jtaguart.c
altera_uart.c
amba-pl010.c
amba-pl011.c
apbuart.c
apbuart.h
atmel_serial.c
bcm63xx_uart.c
bfin_5xx.c serial: bfin_5xx: split uart RX lock from uart port lock to avoid deadlock 2011-02-03 14:44:54 -08:00
bfin_sport_uart.c
bfin_sport_uart.h
clps711x.c
crisv10.c
crisv10.h
dz.c
dz.h
icom.c
icom.h
ifx6x60.c
ifx6x60.h
imx.c
ioc3_serial.c
ioc4_serial.c
ip22zilog.c
ip22zilog.h
Kconfig tty/serial: fix apbuart build 2011-01-22 19:15:02 -08:00
kgdboc.c
m32r_sio.c
m32r_sio.h
m32r_sio_reg.h
Makefile
max3100.c workqueue, freezer: unify spelling of 'freeze' + 'able' to 'freezable' 2011-02-16 17:48:59 +01:00
max3107-aava.c
max3107.c workqueue, freezer: unify spelling of 'freeze' + 'able' to 'freezable' 2011-02-16 17:48:59 +01:00
max3107.h
mcf.c
mfd.c
mpc52xx_uart.c
mpsc.c
mrst_max3110.c
mrst_max3110.h
msm_serial.c
msm_serial.h
mux.c
netx-serial.c
nwpserial.c
of_serial.c
omap-serial.c
pch_uart.c
pmac_zilog.c
pmac_zilog.h
pnx8xxx_uart.c
pxa.c
s3c24a0.c
s3c2400.c
s3c2410.c
s3c2412.c
s3c2440.c
s3c6400.c
s5pv210.c
sa1100.c
samsung.c
samsung.h
sb1250-duart.c console: rename acquire/release_console_sem() to console_lock/unlock() 2011-01-26 10:50:06 +10:00
sc26xx.c
serial_core.c
serial_cs.c
serial_ks8695.c
serial_lh7a40x.c
serial_txx9.c
sh-sci.c
sh-sci.h
sn_console.c
suncore.c
suncore.h
sunhv.c
sunsab.c
sunsab.h
sunsu.c
sunzilog.c
sunzilog.h
timbuart.c
timbuart.h
uartlite.c
ucc_uart.c drivers/serial/ucc_uart.c: Add of_node_put to avoid memory leak 2011-03-15 13:48:16 -05:00
vr41xx_siu.c
vt8500_serial.c
zs.c
zs.h