arm: mach-spear: Add missing of_node_put() in time.c
PATCH v2 1/1 arm: mach-spear: Add missing of_node_put() in time.c
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.
---
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(-)
arch/arm/mach-spear/time.c +6 -2
@@ -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); }
Signature · 1 line
2.25.1
Quoted 44 lines · Liang He
In
spear_setup_of_timer(),of_find_matching_node()will return a node pointer with refcount incrementd. We should useof_node_put()in each fail path or when it is not used anymore.Signed-off-by Liang He <[email protected]>---
changelog:v2: use goto-label patch style suggested by Viresh.
v1: use plainof_node_putin each fail path.arch/arm/mach-spear/time.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)arch/arm/mach-spear/time.c +4
-2@@ -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 ();
arch/arm/mach-spear/time.c void __init spear_setup_of_timer(void) · line 255
Quoted 6 lines
arch/arm/mach-spear/time.c +2
-0@@ -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); }
Signature · 1 line
viresh
This patch was applied to soc/soc.git (arm/fixes) by Arnd Bergmann <[email protected]>:
Hello:
This patch was applied to soc/soc.git (arm/fixes)
by Arnd Bergmann <[email protected]>:
Quoted 9 lines · 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 useof_node_put()in each fail path or when it is not used anymore.Signed-off-by Liang He <[email protected]>---
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html