diff mbox series

[1/5] ARM: actions: Put OF nodes after use

Message ID 20181211080759.3150-1-linus.walleij@linaro.org (mailing list archive)
State New, archived
Headers show
Series [1/5] ARM: actions: Put OF nodes after use | expand

Commit Message

Linus Walleij Dec. 11, 2018, 8:07 a.m. UTC
After using of_find_compatible_node() we need to issue
of_node_put() on the node to keep refcount.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-actions/platsmp.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Stefan Agner Dec. 11, 2018, 1:02 p.m. UTC | #1
On 11.12.2018 09:07, Linus Walleij wrote:
> After using of_find_compatible_node() we need to issue
> of_node_put() on the node to keep refcount.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/mach-actions/platsmp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c
> index 3efaa10efc43..02d17ed0ca31 100644
> --- a/arch/arm/mach-actions/platsmp.c
> +++ b/arch/arm/mach-actions/platsmp.c
> @@ -122,6 +122,7 @@ static void __init s500_smp_prepare_cpus(unsigned
> int max_cpus)
>  	}
>  
>  	timer_base_addr = of_iomap(node, 0);
> +	of_node_put(node);
>  	if (!timer_base_addr) {
>  		pr_err("%s: could not map timer registers\n", __func__);
>  		return;
> @@ -134,6 +135,8 @@ static void __init s500_smp_prepare_cpus(unsigned
> int max_cpus)
>  	}
>  
>  	sps_base_addr = of_iomap(node, 0);
> +	of_node_put(node);
> +

Can you drop this newline to be consistent?

Otherwise looks good to me:

Reviewed-by: Stefan Agner <stefan@agner.ch>

>  	if (!sps_base_addr) {
>  		pr_err("%s: could not map sps registers\n", __func__);
>  		return;
> @@ -147,6 +150,7 @@ static void __init s500_smp_prepare_cpus(unsigned
> int max_cpus)
>  		}
>  
>  		scu_base_addr = of_iomap(node, 0);
> +		of_node_put(node);
>  		if (!scu_base_addr) {
>  			pr_err("%s: could not map scu registers\n", __func__);
>  			return;
Andreas Färber Dec. 18, 2018, 7:49 p.m. UTC | #2
+ linux-actions

Am 11.12.18 um 09:07 schrieb Linus Walleij:
> After using of_find_compatible_node() we need to issue
> of_node_put() on the node to keep refcount.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/mach-actions/platsmp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c
> index 3efaa10efc43..02d17ed0ca31 100644
> --- a/arch/arm/mach-actions/platsmp.c
> +++ b/arch/arm/mach-actions/platsmp.c
> @@ -122,6 +122,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
>  	}
>  
>  	timer_base_addr = of_iomap(node, 0);
> +	of_node_put(node);
>  	if (!timer_base_addr) {
>  		pr_err("%s: could not map timer registers\n", __func__);
>  		return;
> @@ -134,6 +135,8 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
>  	}
>  
>  	sps_base_addr = of_iomap(node, 0);
> +	of_node_put(node);
> +
>  	if (!sps_base_addr) {
>  		pr_err("%s: could not map sps registers\n", __func__);
>  		return;
> @@ -147,6 +150,7 @@ static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
>  		}
>  
>  		scu_base_addr = of_iomap(node, 0);
> +		of_node_put(node);
>  		if (!scu_base_addr) {
>  			pr_err("%s: could not map scu registers\n", __func__);
>  			return;

Looks okay, but does it matter? To my understanding this is all
non-reentrant code.

If you do consider it a bugfix, then we should add a Fixes header:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm/mach-actions?id=172067e0bc8721af3e8626596f91b03f691e88a8

Regards,
Andreas
diff mbox series

Patch

diff --git a/arch/arm/mach-actions/platsmp.c b/arch/arm/mach-actions/platsmp.c
index 3efaa10efc43..02d17ed0ca31 100644
--- a/arch/arm/mach-actions/platsmp.c
+++ b/arch/arm/mach-actions/platsmp.c
@@ -122,6 +122,7 @@  static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
 	}
 
 	timer_base_addr = of_iomap(node, 0);
+	of_node_put(node);
 	if (!timer_base_addr) {
 		pr_err("%s: could not map timer registers\n", __func__);
 		return;
@@ -134,6 +135,8 @@  static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
 	}
 
 	sps_base_addr = of_iomap(node, 0);
+	of_node_put(node);
+
 	if (!sps_base_addr) {
 		pr_err("%s: could not map sps registers\n", __func__);
 		return;
@@ -147,6 +150,7 @@  static void __init s500_smp_prepare_cpus(unsigned int max_cpus)
 		}
 
 		scu_base_addr = of_iomap(node, 0);
+		of_node_put(node);
 		if (!scu_base_addr) {
 			pr_err("%s: could not map scu registers\n", __func__);
 			return;