public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: mach-omap2: omap4-common: Fix refcount leak bug
@ 2022-06-17  3:55 Liang He
  2022-06-28  4:38 ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Liang He @ 2022-06-17  3:55 UTC (permalink / raw)
  To: tony, linux; +Cc: windhl, linux-omap, linux-arm-kernel, linux-kernel

In omap4_sram_init(), of_find_compatible_node() will return a node
pointer with refcount incremented. We should use of_node_put() when
it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 arch/arm/mach-omap2/omap4-common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 6d1eb4eefefe..e981bf57e64f 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -135,6 +135,7 @@ static int __init omap4_sram_init(void)
 		pr_warn("%s:Unable to allocate sram needed to handle errata I688\n",
 			__func__);
 	sram_pool = of_gen_pool_get(np, "sram", 0);
+	of_node_put(np);
 	if (!sram_pool)
 		pr_warn("%s:Unable to get sram pool needed to handle errata I688\n",
 			__func__);
-- 
2.25.1


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

* Re: [PATCH] arm: mach-omap2: omap4-common: Fix refcount leak bug
  2022-06-17  3:55 [PATCH] arm: mach-omap2: omap4-common: Fix refcount leak bug Liang He
@ 2022-06-28  4:38 ` Tony Lindgren
  2022-06-28  5:52   ` Liang He
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2022-06-28  4:38 UTC (permalink / raw)
  To: Liang He; +Cc: linux, linux-omap, linux-arm-kernel, linux-kernel

* Liang He <windhl@126.com> [220617 06:51]:
> In omap4_sram_init(), of_find_compatible_node() will return a node
> pointer with refcount incremented. We should use of_node_put() when
> it is not used anymore.
> 
> Signed-off-by: Liang He <windhl@126.com>
> ---
>  arch/arm/mach-omap2/omap4-common.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
> index 6d1eb4eefefe..e981bf57e64f 100644
> --- a/arch/arm/mach-omap2/omap4-common.c
> +++ b/arch/arm/mach-omap2/omap4-common.c
> @@ -135,6 +135,7 @@ static int __init omap4_sram_init(void)
>  		pr_warn("%s:Unable to allocate sram needed to handle errata I688\n",
>  			__func__);
>  	sram_pool = of_gen_pool_get(np, "sram", 0);
> +	of_node_put(np);
>  	if (!sram_pool)
>  		pr_warn("%s:Unable to get sram pool needed to handle errata I688\n",
>  			__func__);

Here too sram_pool is used aftger of_node_put().

Regards,

Tony

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

* Re:Re: [PATCH] arm: mach-omap2: omap4-common: Fix refcount leak bug
  2022-06-28  4:38 ` Tony Lindgren
@ 2022-06-28  5:52   ` Liang He
  0 siblings, 0 replies; 3+ messages in thread
From: Liang He @ 2022-06-28  5:52 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux, linux-omap, linux-arm-kernel, linux-kernel




At 2022-06-28 12:38:49, "Tony Lindgren" <tony@atomide.com> wrote:
>* Liang He <windhl@126.com> [220617 06:51]:
>> In omap4_sram_init(), of_find_compatible_node() will return a node
>> pointer with refcount incremented. We should use of_node_put() when
>> it is not used anymore.
>> 
>> Signed-off-by: Liang He <windhl@126.com>
>> ---
>>  arch/arm/mach-omap2/omap4-common.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
>> index 6d1eb4eefefe..e981bf57e64f 100644
>> --- a/arch/arm/mach-omap2/omap4-common.c
>> +++ b/arch/arm/mach-omap2/omap4-common.c
>> @@ -135,6 +135,7 @@ static int __init omap4_sram_init(void)
>>  		pr_warn("%s:Unable to allocate sram needed to handle errata I688\n",
>>  			__func__);
>>  	sram_pool = of_gen_pool_get(np, "sram", 0);
>> +	of_node_put(np);
>>  	if (!sram_pool)
>>  		pr_warn("%s:Unable to get sram pool needed to handle errata I688\n",
>>  			__func__);
>
>Here too sram_pool is used aftger of_node_put().
>
>Regards,
>
>Tony

Thanks, Tony.

I will send a new patch to fix the order problem.

Liang


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

end of thread, other threads:[~2022-06-28  5:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-17  3:55 [PATCH] arm: mach-omap2: omap4-common: Fix refcount leak bug Liang He
2022-06-28  4:38 ` Tony Lindgren
2022-06-28  5:52   ` Liang He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox