linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch/powerpc/platforms/powermac/pic.c: move of_node_put
@ 2008-09-21 11:01 Julia Lawall
  2008-09-22  1:12 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2008-09-21 11:01 UTC (permalink / raw)
  To: paulus, benh, linuxppc-dev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

It seems better to dereference master before decrementing the reference
count rather than afterwards.

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

// <smpl>
@r exists@
expression n,E;
identifier fld;
iterator I;
statement S;
@@

* of_node_put(n)
... when != n = E
    when != I(n,...) S
* n->fld
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---

 arch/powerpc/platforms/powermac/pic.c          |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 6d149ae..d17aa2b 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -395,10 +395,10 @@ static void __init pmac_pic_probe_oldstyle(void)
 	if (max_real_irqs > 32)
 		pmac_irq_hw[i++] = (volatile struct pmac_irq_hw __iomem *)
 			(addr + 0x10);
-	of_node_put(master);
 
 	printk(KERN_INFO "irq: Found primary Apple PIC %s for %d irqs\n",
 	       master->full_name, max_real_irqs);
+	of_node_put(master);
 
 	/* Map interrupts of cascaded controller */
 	if (slave && !of_address_to_resource(slave, 0, &r)) {

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

end of thread, other threads:[~2008-09-22  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-21 11:01 [PATCH] arch/powerpc/platforms/powermac/pic.c: move of_node_put Julia Lawall
2008-09-22  1:12 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).