提交 75e89b02 编写于 作者: J Julia Lawall 提交者: Paul Mackerras

[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: NJulia 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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 b1725c93
...@@ -134,13 +134,12 @@ static void __init mpc8272_ads_setup_arch(void) ...@@ -134,13 +134,12 @@ static void __init mpc8272_ads_setup_arch(void)
} }
bcsr = of_iomap(np, 0); bcsr = of_iomap(np, 0);
of_node_put(np);
if (!bcsr) { if (!bcsr) {
printk(KERN_ERR "Cannot map BCSR registers\n"); printk(KERN_ERR "Cannot map BCSR registers\n");
return; return;
} }
of_node_put(np);
clrbits32(&bcsr[1], BCSR1_RS232_EN1 | BCSR1_RS232_EN2 | BCSR1_FETHIEN); clrbits32(&bcsr[1], BCSR1_RS232_EN1 | BCSR1_RS232_EN2 | BCSR1_FETHIEN);
setbits32(&bcsr[1], BCSR1_FETH_RST); setbits32(&bcsr[1], BCSR1_FETH_RST);
......
...@@ -130,13 +130,12 @@ static void __init pq2fads_setup_arch(void) ...@@ -130,13 +130,12 @@ static void __init pq2fads_setup_arch(void)
} }
bcsr = of_iomap(np, 0); bcsr = of_iomap(np, 0);
of_node_put(np);
if (!bcsr) { if (!bcsr) {
printk(KERN_ERR "Cannot map BCSR registers\n"); printk(KERN_ERR "Cannot map BCSR registers\n");
return; return;
} }
of_node_put(np);
/* Enable the serial and ethernet ports */ /* Enable the serial and ethernet ports */
clrbits32(&bcsr[1], BCSR1_RS232_EN1 | BCSR1_RS232_EN2 | BCSR1_FETHIEN); clrbits32(&bcsr[1], BCSR1_RS232_EN1 | BCSR1_RS232_EN2 | BCSR1_FETHIEN);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册