All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] arm: mach-spear: Add missing of_node_put() in time.c
@ 2022-06-16  9:30 ` Liang He
  0 siblings, 0 replies; 5+ messages in thread
From: Liang He @ 2022-06-16  9:30 UTC (permalink / raw)
  To: vireshk, shiraz.linux.kernel, soc, linux
  Cc: linux-arm-kernel, linux-kernel, windhl

In spear_setup_of_timer(), of_find_matching_node() will return a
node pointer with refcount incrementd. We should use of_node_put()
in each fail path or when it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 changelog:
 
 v2: use goto-label patch style suggested by Viresh.
 v1: use plain of_node_put in each fail path.

 arch/arm/mach-spear/time.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
index d1fdb6066f7b..c7c17c0f936c 100644
--- a/arch/arm/mach-spear/time.c
+++ b/arch/arm/mach-spear/time.c
@@ -218,13 +218,13 @@ void __init spear_setup_of_timer(void)
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
 		pr_err("%s: No irq passed for timer via DT\n", __func__);
-		return;
+		goto err_put_np;
 	}
 
 	gpt_base = of_iomap(np, 0);
 	if (!gpt_base) {
 		pr_err("%s: of iomap failed\n", __func__);
-		return;
+		goto err_put_np;
 	}
 
 	gpt_clk = clk_get_sys("gpt0", NULL);
@@ -239,6 +239,8 @@ void __init spear_setup_of_timer(void)
 		goto err_prepare_enable_clk;
 	}
 
+	of_node_put(np);
+
 	spear_clockevent_init(irq);
 	spear_clocksource_init();
 
@@ -248,4 +250,6 @@ void __init spear_setup_of_timer(void)
 	clk_put(gpt_clk);
 err_iomap:
 	iounmap(gpt_base);
+err_put_np:
+	of_node_put(np);
 }
-- 
2.25.1


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

* [PATCH v2] arm: mach-spear: Add missing of_node_put() in time.c
@ 2022-06-16  9:30 ` Liang He
  0 siblings, 0 replies; 5+ messages in thread
From: Liang He @ 2022-06-16  9:30 UTC (permalink / raw)
  To: vireshk, shiraz.linux.kernel, soc, linux
  Cc: linux-arm-kernel, linux-kernel, windhl

In spear_setup_of_timer(), of_find_matching_node() will return a
node pointer with refcount incrementd. We should use of_node_put()
in each fail path or when it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 changelog:
 
 v2: use goto-label patch style suggested by Viresh.
 v1: use plain of_node_put in each fail path.

 arch/arm/mach-spear/time.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
index d1fdb6066f7b..c7c17c0f936c 100644
--- a/arch/arm/mach-spear/time.c
+++ b/arch/arm/mach-spear/time.c
@@ -218,13 +218,13 @@ void __init spear_setup_of_timer(void)
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
 		pr_err("%s: No irq passed for timer via DT\n", __func__);
-		return;
+		goto err_put_np;
 	}
 
 	gpt_base = of_iomap(np, 0);
 	if (!gpt_base) {
 		pr_err("%s: of iomap failed\n", __func__);
-		return;
+		goto err_put_np;
 	}
 
 	gpt_clk = clk_get_sys("gpt0", NULL);
@@ -239,6 +239,8 @@ void __init spear_setup_of_timer(void)
 		goto err_prepare_enable_clk;
 	}
 
+	of_node_put(np);
+
 	spear_clockevent_init(irq);
 	spear_clocksource_init();
 
@@ -248,4 +250,6 @@ void __init spear_setup_of_timer(void)
 	clk_put(gpt_clk);
 err_iomap:
 	iounmap(gpt_base);
+err_put_np:
+	of_node_put(np);
 }
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] arm: mach-spear: Add missing of_node_put() in time.c
  2022-06-16  9:30 ` Liang He
@ 2022-06-16  9:51   ` Viresh Kumar
  -1 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2022-06-16  9:51 UTC (permalink / raw)
  To: Liang He
  Cc: vireshk, shiraz.linux.kernel, soc, linux, linux-arm-kernel,
	linux-kernel

On 16-06-22, 17:30, Liang He wrote:
> In spear_setup_of_timer(), of_find_matching_node() will return a
> node pointer with refcount incrementd. We should use of_node_put()
> in each fail path or when it is not used anymore.
> 
> Signed-off-by: Liang He <windhl@126.com>
> ---
>  changelog:
>  
>  v2: use goto-label patch style suggested by Viresh.
>  v1: use plain of_node_put in each fail path.
> 
>  arch/arm/mach-spear/time.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
> index d1fdb6066f7b..c7c17c0f936c 100644
> --- a/arch/arm/mach-spear/time.c
> +++ b/arch/arm/mach-spear/time.c
> @@ -218,13 +218,13 @@ void __init spear_setup_of_timer(void)
>  	irq = irq_of_parse_and_map(np, 0);
>  	if (!irq) {
>  		pr_err("%s: No irq passed for timer via DT\n", __func__);
> -		return;
> +		goto err_put_np;
>  	}
>  
>  	gpt_base = of_iomap(np, 0);
>  	if (!gpt_base) {
>  		pr_err("%s: of iomap failed\n", __func__);
> -		return;
> +		goto err_put_np;
>  	}
>  
>  	gpt_clk = clk_get_sys("gpt0", NULL);
> @@ -239,6 +239,8 @@ void __init spear_setup_of_timer(void)
>  		goto err_prepare_enable_clk;
>  	}
>  
> +	of_node_put(np);
> +
>  	spear_clockevent_init(irq);
>  	spear_clocksource_init();
>  
> @@ -248,4 +250,6 @@ void __init spear_setup_of_timer(void)
>  	clk_put(gpt_clk);
>  err_iomap:
>  	iounmap(gpt_base);
> +err_put_np:
> +	of_node_put(np);
>  }

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

* Re: [PATCH v2] arm: mach-spear: Add missing of_node_put() in time.c
@ 2022-06-16  9:51   ` Viresh Kumar
  0 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2022-06-16  9:51 UTC (permalink / raw)
  To: Liang He
  Cc: vireshk, shiraz.linux.kernel, soc, linux, linux-arm-kernel,
	linux-kernel

On 16-06-22, 17:30, Liang He wrote:
> In spear_setup_of_timer(), of_find_matching_node() will return a
> node pointer with refcount incrementd. We should use of_node_put()
> in each fail path or when it is not used anymore.
> 
> Signed-off-by: Liang He <windhl@126.com>
> ---
>  changelog:
>  
>  v2: use goto-label patch style suggested by Viresh.
>  v1: use plain of_node_put in each fail path.
> 
>  arch/arm/mach-spear/time.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
> index d1fdb6066f7b..c7c17c0f936c 100644
> --- a/arch/arm/mach-spear/time.c
> +++ b/arch/arm/mach-spear/time.c
> @@ -218,13 +218,13 @@ void __init spear_setup_of_timer(void)
>  	irq = irq_of_parse_and_map(np, 0);
>  	if (!irq) {
>  		pr_err("%s: No irq passed for timer via DT\n", __func__);
> -		return;
> +		goto err_put_np;
>  	}
>  
>  	gpt_base = of_iomap(np, 0);
>  	if (!gpt_base) {
>  		pr_err("%s: of iomap failed\n", __func__);
> -		return;
> +		goto err_put_np;
>  	}
>  
>  	gpt_clk = clk_get_sys("gpt0", NULL);
> @@ -239,6 +239,8 @@ void __init spear_setup_of_timer(void)
>  		goto err_prepare_enable_clk;
>  	}
>  
> +	of_node_put(np);
> +
>  	spear_clockevent_init(irq);
>  	spear_clocksource_init();
>  
> @@ -248,4 +250,6 @@ void __init spear_setup_of_timer(void)
>  	clk_put(gpt_clk);
>  err_iomap:
>  	iounmap(gpt_base);
> +err_put_np:
> +	of_node_put(np);
>  }

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] arm: mach-spear: Add missing of_node_put() in time.c
  2022-06-16  9:30 ` Liang He
  (?)
  (?)
@ 2022-06-24 16:00 ` patchwork-bot+linux-soc
  -1 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+linux-soc @ 2022-06-24 16:00 UTC (permalink / raw)
  To: Liang He; +Cc: soc

Hello:

This patch was applied to soc/soc.git (arm/fixes)
by Arnd Bergmann <arnd@arndb.de>:

On Thu, 16 Jun 2022 17:30:27 +0800 you wrote:
> In spear_setup_of_timer(), of_find_matching_node() will return a
> node pointer with refcount incrementd. We should use of_node_put()
> in each fail path or when it is not used anymore.
> 
> Signed-off-by: Liang He <windhl@126.com>
> ---
>  changelog:
> 
> [...]

Here is the summary with links:
  - [v2] arm: mach-spear: Add missing of_node_put() in time.c
    https://git.kernel.org/soc/soc/c/2c629dd2d14f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-06-24 16:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-16  9:30 [PATCH v2] arm: mach-spear: Add missing of_node_put() in time.c Liang He
2022-06-16  9:30 ` Liang He
2022-06-16  9:51 ` Viresh Kumar
2022-06-16  9:51   ` Viresh Kumar
2022-06-24 16:00 ` patchwork-bot+linux-soc

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.