linux/arch
Nicolas Palix c2e27c359a sparc: Add missing of_node_put
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;
struct device_node *n1;
statement S;
identifier f;
expression E;
expression *ptr != NULL;
@@

n@p1 = of_find_node_by_name(...)
...
if (!n) S
... when != of_node_put(n)
    when != n1 = f(n,...)
    when != E = n
    when any
    when strict
(
  return \(0\|<+...n...+>\|ptr\);
|
return@p2 ...;
|
  of_node_put(n);
|
  n1 = f(n,...)
|
  E = 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>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-04 09:17:22 -08:00
..
alpha alpha: pcibios_resource_to_bus() is callable from normal code 2008-11-30 10:03:37 -08:00
arm spi: fix spi_s3c24xx_gpio num_chipselect 2008-12-01 19:55:24 -08:00
avr32 Merge branches 'boards' and 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6 2008-10-23 15:24:10 +02:00
blackfin Blackfin arch: fix a broken define in dma-mapping 2008-11-18 17:48:22 +08:00
cris [CRIS] Remove links from CRIS build 2008-10-31 23:37:57 +01:00
frv frv: fix mmap2 error handling 2008-12-01 19:55:24 -08:00
h8300 Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb 2008-10-23 08:20:34 -07:00
ia64 Merge branch 'kvm-updates/2.6.28' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm 2008-12-02 15:56:17 -08:00
m32r m32r: section noise in head.S 2008-11-30 10:03:37 -08:00
m68k m68k: Update defconfigs for 2.6.28-rc7 2008-12-02 20:58:26 +01:00
m68knommu container freezer: implement freezer cgroup subsystem 2008-10-20 08:52:34 -07:00
mips remove __ARCH_WANT_COMPAT_SYS_PTRACE 2008-11-30 11:00:15 -08:00
mn10300 MN10300: Fix application of kernel module relocations 2008-12-02 15:52:07 -08:00
parisc Merge git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6 2008-11-30 14:04:31 -08:00
powerpc powerpc/83xx: Fix MCU support merge issue in mpc8349emitx.dts 2008-12-03 09:56:02 -06:00
s390 Merge branch 'kvm-updates/2.6.28' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm 2008-12-02 15:56:17 -08:00
sh serial: sh-sci: Reorder the SCxTDR write after the TDxE clear. 2008-11-13 17:46:06 +09:00
sparc sparc: Add missing of_node_put 2008-12-04 09:17:22 -08:00
um Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev 2008-10-23 10:23:07 -07:00
x86 Merge branch 'kvm-updates/2.6.28' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm 2008-12-02 15:56:17 -08:00
xtensa Merge git://git.kernel.org/pub/scm/linux/kernel/git/czankel/xtensa-2.6 2008-10-23 09:16:56 -07:00
.gitignore
Kconfig remove __ARCH_WANT_COMPAT_SYS_PTRACE 2008-11-30 11:00:15 -08:00