mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] arch/powerpc/platforms/pseries: Add missing of_node_put
@ 2008-01-01 21:02 Julia Lawall
  2008-01-02  0:18 ` Stephen Rothwell
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2008-01-01 21:02 UTC (permalink / raw)
  To: paulus, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Of_get_parent and of_find_compatible_node do an of_node_get, and thus a
corresponding of_code_put is needed in the error 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>
---

diff -u -p a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
--- a/arch/powerpc/platforms/pseries/reconfig.c	2007-07-20 17:45:44.000000000 +0200
+++ b/arch/powerpc/platforms/pseries/reconfig.c	2008-01-01 14:33:54.000000000 +0100
@@ -167,6 +167,7 @@ static int pSeries_reconfig_remove_node(
 
 	if ((child = of_get_next_child(np, NULL))) {
 		of_node_put(child);
+		of_node_put(parent);
 		return -EBUSY;
 	}
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/3] arch/powerpc/platforms/pseries: Add missing of_node_put
  2008-01-01 21:02 [PATCH 1/3] arch/powerpc/platforms/pseries: Add missing of_node_put Julia Lawall
@ 2008-01-02  0:18 ` Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2008-01-02  0:18 UTC (permalink / raw)
  To: Julia Lawall; +Cc: paulus, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

On Tue, 1 Jan 2008 22:02:49 +0100 (CET) Julia Lawall <julia@diku.dk> wrote:
>
> From: Julia Lawall <julia@diku.dk>
> 
> Of_get_parent and of_find_compatible_node do an of_node_get, and thus a
> corresponding of_code_put is needed in the error case.

Thanks for these.

In the future, any patch that touches arch/powerpc (or
include/asm-powerpc) should be (at least) cc'd to linuxppc-dev@ozlabs.org
(where the PowerPC developers lurk).  That way they will also be saved in
Patchwork (http://patchwork.ozlabs.org/) and not lost.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-02  0:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-01 21:02 [PATCH 1/3] arch/powerpc/platforms/pseries: Add missing of_node_put Julia Lawall
2008-01-02  0:18 ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®