All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: spin-table: add missing of_node_put()
@ 2016-04-20  1:23 ` Masahiro Yamada
  0 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-04-20  1:23 UTC (permalink / raw)
  To: linux-arm-kernel

Since of_get_cpu_node() increments refcount, the node should be put.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm64/kernel/smp_spin_table.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index aef3605..18a71bc 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -52,6 +52,7 @@ static void write_pen_release(u64 val)
 static int smp_spin_table_cpu_init(unsigned int cpu)
 {
 	struct device_node *dn;
+	int ret;
 
 	dn = of_get_cpu_node(cpu, NULL);
 	if (!dn)
@@ -60,15 +61,15 @@ static int smp_spin_table_cpu_init(unsigned int cpu)
 	/*
 	 * Determine the address from which the CPU is polling.
 	 */
-	if (of_property_read_u64(dn, "cpu-release-addr",
-				 &cpu_release_addr[cpu])) {
+	ret = of_property_read_u64(dn, "cpu-release-addr",
+				   &cpu_release_addr[cpu]);
+	if (ret)
 		pr_err("CPU %d: missing or invalid cpu-release-addr property\n",
 		       cpu);
 
-		return -1;
-	}
+	of_node_put(dn);
 
-	return 0;
+	return ret;
 }
 
 static int smp_spin_table_cpu_prepare(unsigned int cpu)
-- 
1.9.1

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

* [PATCH] arm64: spin-table: add missing of_node_put()
@ 2016-04-20  1:23 ` Masahiro Yamada
  0 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-04-20  1:23 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Mark Rutland, Rob Herring,
	Masahiro Yamada, Hanjun Guo, Lorenzo Pieralisi,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Sudeep Holla, Will Deacon,
	Catalin Marinas

Since of_get_cpu_node() increments refcount, the node should be put.

Signed-off-by: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
---

 arch/arm64/kernel/smp_spin_table.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index aef3605..18a71bc 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -52,6 +52,7 @@ static void write_pen_release(u64 val)
 static int smp_spin_table_cpu_init(unsigned int cpu)
 {
 	struct device_node *dn;
+	int ret;
 
 	dn = of_get_cpu_node(cpu, NULL);
 	if (!dn)
@@ -60,15 +61,15 @@ static int smp_spin_table_cpu_init(unsigned int cpu)
 	/*
 	 * Determine the address from which the CPU is polling.
 	 */
-	if (of_property_read_u64(dn, "cpu-release-addr",
-				 &cpu_release_addr[cpu])) {
+	ret = of_property_read_u64(dn, "cpu-release-addr",
+				   &cpu_release_addr[cpu]);
+	if (ret)
 		pr_err("CPU %d: missing or invalid cpu-release-addr property\n",
 		       cpu);
 
-		return -1;
-	}
+	of_node_put(dn);
 
-	return 0;
+	return ret;
 }
 
 static int smp_spin_table_cpu_prepare(unsigned int cpu)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] arm64: spin-table: add missing of_node_put()
@ 2016-04-20  1:23 ` Masahiro Yamada
  0 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2016-04-20  1:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: devicetree, Mark Rutland, Rob Herring, Masahiro Yamada,
	Hanjun Guo, Lorenzo Pieralisi, linux-kernel, Sudeep Holla,
	Will Deacon, Catalin Marinas

Since of_get_cpu_node() increments refcount, the node should be put.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm64/kernel/smp_spin_table.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index aef3605..18a71bc 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -52,6 +52,7 @@ static void write_pen_release(u64 val)
 static int smp_spin_table_cpu_init(unsigned int cpu)
 {
 	struct device_node *dn;
+	int ret;
 
 	dn = of_get_cpu_node(cpu, NULL);
 	if (!dn)
@@ -60,15 +61,15 @@ static int smp_spin_table_cpu_init(unsigned int cpu)
 	/*
 	 * Determine the address from which the CPU is polling.
 	 */
-	if (of_property_read_u64(dn, "cpu-release-addr",
-				 &cpu_release_addr[cpu])) {
+	ret = of_property_read_u64(dn, "cpu-release-addr",
+				   &cpu_release_addr[cpu]);
+	if (ret)
 		pr_err("CPU %d: missing or invalid cpu-release-addr property\n",
 		       cpu);
 
-		return -1;
-	}
+	of_node_put(dn);
 
-	return 0;
+	return ret;
 }
 
 static int smp_spin_table_cpu_prepare(unsigned int cpu)
-- 
1.9.1

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

* [PATCH] arm64: spin-table: add missing of_node_put()
  2016-04-20  1:23 ` Masahiro Yamada
@ 2016-04-20  9:17   ` Will Deacon
  -1 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2016-04-20  9:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 20, 2016 at 10:23:31AM +0900, Masahiro Yamada wrote:
> Since of_get_cpu_node() increments refcount, the node should be put.

Urgh, I really hate the dt refcounting stuff.

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  arch/arm64/kernel/smp_spin_table.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
> index aef3605..18a71bc 100644
> --- a/arch/arm64/kernel/smp_spin_table.c
> +++ b/arch/arm64/kernel/smp_spin_table.c
> @@ -52,6 +52,7 @@ static void write_pen_release(u64 val)
>  static int smp_spin_table_cpu_init(unsigned int cpu)
>  {
>  	struct device_node *dn;
> +	int ret;
>  
>  	dn = of_get_cpu_node(cpu, NULL);
>  	if (!dn)
> @@ -60,15 +61,15 @@ static int smp_spin_table_cpu_init(unsigned int cpu)
>  	/*
>  	 * Determine the address from which the CPU is polling.
>  	 */
> -	if (of_property_read_u64(dn, "cpu-release-addr",
> -				 &cpu_release_addr[cpu])) {
> +	ret = of_property_read_u64(dn, "cpu-release-addr",
> +				   &cpu_release_addr[cpu]);
> +	if (ret)
>  		pr_err("CPU %d: missing or invalid cpu-release-addr property\n",
>  		       cpu);
>  
> -		return -1;
> -	}
> +	of_node_put(dn);
>  
> -	return 0;
> +	return ret;


Looks ok to me. The slight change in return code should be harmless for
->cpu_init.

Acked-by: Will Deacon <will.deacon@arm.com>

Will

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

* Re: [PATCH] arm64: spin-table: add missing of_node_put()
@ 2016-04-20  9:17   ` Will Deacon
  0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2016-04-20  9:17 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-arm-kernel, devicetree, Mark Rutland, Rob Herring,
	Hanjun Guo, Lorenzo Pieralisi, linux-kernel, Sudeep Holla,
	Catalin Marinas

On Wed, Apr 20, 2016 at 10:23:31AM +0900, Masahiro Yamada wrote:
> Since of_get_cpu_node() increments refcount, the node should be put.

Urgh, I really hate the dt refcounting stuff.

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  arch/arm64/kernel/smp_spin_table.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
> index aef3605..18a71bc 100644
> --- a/arch/arm64/kernel/smp_spin_table.c
> +++ b/arch/arm64/kernel/smp_spin_table.c
> @@ -52,6 +52,7 @@ static void write_pen_release(u64 val)
>  static int smp_spin_table_cpu_init(unsigned int cpu)
>  {
>  	struct device_node *dn;
> +	int ret;
>  
>  	dn = of_get_cpu_node(cpu, NULL);
>  	if (!dn)
> @@ -60,15 +61,15 @@ static int smp_spin_table_cpu_init(unsigned int cpu)
>  	/*
>  	 * Determine the address from which the CPU is polling.
>  	 */
> -	if (of_property_read_u64(dn, "cpu-release-addr",
> -				 &cpu_release_addr[cpu])) {
> +	ret = of_property_read_u64(dn, "cpu-release-addr",
> +				   &cpu_release_addr[cpu]);
> +	if (ret)
>  		pr_err("CPU %d: missing or invalid cpu-release-addr property\n",
>  		       cpu);
>  
> -		return -1;
> -	}
> +	of_node_put(dn);
>  
> -	return 0;
> +	return ret;


Looks ok to me. The slight change in return code should be harmless for
->cpu_init.

Acked-by: Will Deacon <will.deacon@arm.com>

Will

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

* [PATCH] arm64: spin-table: add missing of_node_put()
@ 2016-04-20  9:35   ` Catalin Marinas
  0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2016-04-20  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 20, 2016 at 10:23:31AM +0900, Masahiro Yamada wrote:
> Since of_get_cpu_node() increments refcount, the node should be put.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Queued for 4.6. Thanks.

-- 
Catalin

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

* Re: [PATCH] arm64: spin-table: add missing of_node_put()
@ 2016-04-20  9:35   ` Catalin Marinas
  0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2016-04-20  9:35 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Mark Rutland,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Lorenzo Pieralisi, Will Deacon,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Hanjun Guo,
	Sudeep Holla

On Wed, Apr 20, 2016 at 10:23:31AM +0900, Masahiro Yamada wrote:
> Since of_get_cpu_node() increments refcount, the node should be put.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>

Queued for 4.6. Thanks.

-- 
Catalin
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] arm64: spin-table: add missing of_node_put()
@ 2016-04-20  9:35   ` Catalin Marinas
  0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2016-04-20  9:35 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-arm-kernel, Mark Rutland, devicetree, Lorenzo Pieralisi,
	Will Deacon, linux-kernel, Rob Herring, Hanjun Guo, Sudeep Holla

On Wed, Apr 20, 2016 at 10:23:31AM +0900, Masahiro Yamada wrote:
> Since of_get_cpu_node() increments refcount, the node should be put.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Queued for 4.6. Thanks.

-- 
Catalin

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

end of thread, other threads:[~2016-04-20  9:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-20  1:23 [PATCH] arm64: spin-table: add missing of_node_put() Masahiro Yamada
2016-04-20  1:23 ` Masahiro Yamada
2016-04-20  1:23 ` Masahiro Yamada
2016-04-20  9:17 ` Will Deacon
2016-04-20  9:17   ` Will Deacon
2016-04-20  9:35 ` Catalin Marinas
2016-04-20  9:35   ` Catalin Marinas
2016-04-20  9:35   ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.