diff mbox

[1/3] powerpc: numa: Remove double of_node_put in hot_add_node_scn_to_nid

Message ID 20110810064937.424887717@samba.org (mailing list archive)
State Superseded
Headers show

Commit Message

Anton Blanchard Aug. 10, 2011, 6:49 a.m. UTC
During memory hotplug testing, I got the following warning:


ERROR: Bad of_node_put() on /memory@0

of_node_release
kref_put
of_node_put
of_find_node_by_type
hot_add_node_scn_to_nid
hot_add_scn_to_nid
memory_add_physaddr_to_nid
...


of_find_node_by_type() loop does of_node_put for us so remove the
duplicate one inside the loop.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@kernel.org
---

Comments

Stephen Rothwell Aug. 10, 2011, 8:33 a.m. UTC | #1
Hi Anton,

On Wed, 10 Aug 2011 16:49:34 +1000 Anton Blanchard <anton@samba.org> wrote:
>
> During memory hotplug testing, I got the following warning:
> 
> 
> ERROR: Bad of_node_put() on /memory@0
> 
> of_find_node_by_type() loop does of_node_put for us so remove the
> duplicate one inside the loop.

But does an of_node_get() on its return value ..

> Signed-off-by: Anton Blanchard <anton@samba.org>
> Cc: stable@kernel.org
> ---
> 
> Index: linux-powerpc/arch/powerpc/mm/numa.c
> ===================================================================
> --- linux-powerpc.orig/arch/powerpc/mm/numa.c	2011-06-06 08:07:35.148708089 +1000
> +++ linux-powerpc/arch/powerpc/mm/numa.c	2011-08-10 11:31:59.723379868 +1000
> @@ -1214,7 +1214,6 @@ int hot_add_node_scn_to_nid(unsigned lon
>  			break;
>  		}
>  
> -		of_node_put(memory);
>  		if (nid >= 0)
>  			break;
>  	}

Won't that need an of_node_put(memory) after the loop if (nid >= 0) ?  In
fact you should be able to just move the of_node_put(memory) to after the
loop since of_node_put(NULL) is fine.
Anton Blanchard Aug. 10, 2011, 11:28 a.m. UTC | #2
Hi Stephen,

> > Index: linux-powerpc/arch/powerpc/mm/numa.c
> > ===================================================================
> > --- linux-powerpc.orig/arch/powerpc/mm/numa.c	2011-06-06
> > 08:07:35.148708089 +1000 +++
> > linux-powerpc/arch/powerpc/mm/numa.c	2011-08-10
> > 11:31:59.723379868 +1000 @@ -1214,7 +1214,6 @@ int
> > hot_add_node_scn_to_nid(unsigned lon break; }
> >  
> > -		of_node_put(memory);
> >  		if (nid >= 0)
> >  			break;
> >  	}
> 
> Won't that need an of_node_put(memory) after the loop if (nid >=
> 0) ?  In fact you should be able to just move the of_node_put(memory)
> to after the loop since of_node_put(NULL) is fine.

Nice catch! Will respin the patch.

Anton
diff mbox

Patch

Index: linux-powerpc/arch/powerpc/mm/numa.c
===================================================================
--- linux-powerpc.orig/arch/powerpc/mm/numa.c	2011-06-06 08:07:35.148708089 +1000
+++ linux-powerpc/arch/powerpc/mm/numa.c	2011-08-10 11:31:59.723379868 +1000
@@ -1214,7 +1214,6 @@  int hot_add_node_scn_to_nid(unsigned lon
 			break;
 		}
 
-		of_node_put(memory);
 		if (nid >= 0)
 			break;
 	}