[1/2] ARM: highbank: add missing of_node_put call

Message ID 20221218142647.394881-2-martin@kaiser.cx
State New
Headers
Series ARM: highbank: add missing of_node_put calls |

Commit Message

Martin Kaiser Dec. 18, 2022, 2:26 p.m. UTC
  A node that is returned by of_find_compatible_node has its refcount
incremented. We have to call of_node_put when the node is no longer
needed.

Add a missing of_node_put call in function highbank_init.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 arch/arm/mach-highbank/highbank.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Andre Przywara Dec. 20, 2022, 1:32 p.m. UTC | #1
On Sun, 18 Dec 2022 15:26:46 +0100
Martin Kaiser <martin@kaiser.cx> wrote:

Hi Martin,

> A node that is returned by of_find_compatible_node has its refcount
> incremented. We have to call of_node_put when the node is no longer
> needed.
> 
> Add a missing of_node_put call in function highbank_init.

Thanks for the patch.
So Ruyi sent the exact same one earlier this year already:
https://lore.kernel.org/linux-arm-kernel/20220408094817.2494756-1-lv.ruyi@zte.com.cn/

I asked Arnd and Olof to take it back then (see my reply), but this somehow
got lost.

I will try to push on both Ruyi's and your second patch again - but I
guess only after the holidays.

Cheers,
Andre

> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  arch/arm/mach-highbank/highbank.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
> index 5d4f977ac7d2..97ccb8c1b3cd 100644
> --- a/arch/arm/mach-highbank/highbank.c
> +++ b/arch/arm/mach-highbank/highbank.c
> @@ -141,6 +141,7 @@ static void __init highbank_init(void)
>  	/* Map system registers */
>  	np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
>  	sregs_base = of_iomap(np, 0);
> +	of_node_put(np);
>  	WARN_ON(!sregs_base);
>  
>  	pm_power_off = highbank_power_off;
  

Patch

diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 5d4f977ac7d2..97ccb8c1b3cd 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -141,6 +141,7 @@  static void __init highbank_init(void)
 	/* Map system registers */
 	np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
 	sregs_base = of_iomap(np, 0);
+	of_node_put(np);
 	WARN_ON(!sregs_base);
 
 	pm_power_off = highbank_power_off;