linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: zynq: Fix refcount leak in zynq_get_revision
@ 2022-06-05  8:28 Miaoqian Lin
  2022-06-29 12:43 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-06-05  8:28 UTC (permalink / raw)
  To: Russell King, Michal Simek, linux-arm-kernel, linux-kernel; +Cc: linmq006

of_find_compatible_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 00f7dc636366 ("ARM: zynq: Add support for SOC_BUS")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/arm/mach-zynq/common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index e1ca6a5732d2..15e8a321a713 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -77,6 +77,7 @@ static int __init zynq_get_revision(void)
 	}
 
 	zynq_devcfg_base = of_iomap(np, 0);
+	of_node_put(np);
 	if (!zynq_devcfg_base) {
 		pr_err("%s: Unable to map I/O memory\n", __func__);
 		return -1;
-- 
2.25.1


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

* Re: [PATCH] cpufreq: zynq: Fix refcount leak in zynq_get_revision
  2022-06-05  8:28 [PATCH] cpufreq: zynq: Fix refcount leak in zynq_get_revision Miaoqian Lin
@ 2022-06-29 12:43 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2022-06-29 12:43 UTC (permalink / raw)
  To: Miaoqian Lin, Russell King, Michal Simek, linux-arm-kernel, linux-kernel



On 6/5/22 10:28, Miaoqian Lin wrote:
> of_find_compatible_node() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when done.
> Add missing of_node_put() to avoid refcount leak.
> 
> Fixes: 00f7dc636366 ("ARM: zynq: Add support for SOC_BUS")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>   arch/arm/mach-zynq/common.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
> index e1ca6a5732d2..15e8a321a713 100644
> --- a/arch/arm/mach-zynq/common.c
> +++ b/arch/arm/mach-zynq/common.c
> @@ -77,6 +77,7 @@ static int __init zynq_get_revision(void)
>   	}
>   
>   	zynq_devcfg_base = of_iomap(np, 0);
> +	of_node_put(np);
>   	if (!zynq_devcfg_base) {
>   		pr_err("%s: Unable to map I/O memory\n", __func__);
>   		return -1;

Applied.
M

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

end of thread, other threads:[~2022-06-29 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05  8:28 [PATCH] cpufreq: zynq: Fix refcount leak in zynq_get_revision Miaoqian Lin
2022-06-29 12:43 ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).