[POWERPC] arch/powerpc/platforms/82xx: Add missing of_node_put
authorJulia Lawall <julia@diku.dk>
Tue, 5 Feb 2008 07:35:00 +0000 (23:35 -0800)
committerPaul Mackerras <paulus@samba.org>
Wed, 6 Feb 2008 11:06:59 +0000 (22:06 +1100)
commit75e89b02e338d0db27f8e5d66642c7e2ae49c326
tree008b0bfd58d1ae35bc0d4b2782368dceec6e81a3
parentb1725c9319aae42d7bd1159fc99e033d5a3076f8
[POWERPC] arch/powerpc/platforms/82xx: Add missing of_node_put

Of_get_parent and of_find_compatible_node do a of_node_get, and thus a
corresponding of_code_put is needed in both the error case and the normal
return case.

The problem was found using the following semantic match.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T,T1,T2;
identifier E;
statement S;
expression x1,x2,x3;
int ret;
@@

  T E;
  ...
* E = \(of_get_parent\|of_find_compatible_node\)(...);
  if (E == NULL) S
  ... when != of_node_put(...,(T1)E,...)
      when != if (E != NULL) { ... of_node_put(...,(T1)E,...); ...}
      when != x1 = (T1)E
      when != E = x3;
      when any
  if (...) {
    ... when != of_node_put(...,(T2)E,...)
        when != if (E != NULL) { ... of_node_put(...,(T2)E,...); ...}
        when != x2 = (T2)E
(
*   return;
|
*   return ret;
)
  }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kumar Gala <galak@gate.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/82xx/mpc8272_ads.c
arch/powerpc/platforms/82xx/pq2fads.c