Skip to contentSkip to conversation

cpufreq: zynq: Fix refcount leak in zynq_get_revision

PATCH Applied Miaoqian Lin 2 participants 2 messages Jun 5, 2022 – Jun 29, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: zynq: Fix refcount leak in zynq_get_revision

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")
---
 arch/arm/mach-zynq/common.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-zynq/common.c +1 -0
index e1ca6a5732d2..15e8a321a713 100644
@@ -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;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Applied
#1 lore raw
Quoted 15 lines · Miaoqian Lin

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")
---
  arch/arm/mach-zynq/common.c | 1 +
  1 file changed, 1 insertion(+)
arch/arm/mach-zynq/common.c +0 -0
index e1ca6a5732d2..15e8a321a713 100644

arch/arm/mach-zynq/common.c static int __init zynq_get_revision(void) · line 83

Quoted 7 lines
arch/arm/mach-zynq/common.c +1 -0
@@ -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