[PATCH v1] ARM: highbank: Fix OF node refcount leaks

Yuho Choi dbgh9129 at gmail.com
Sun May 24 20:13:12 PDT 2026


highbank_init_irq() checks for a Cortex-A9 node with
of_find_compatible_node(), but uses the returned node only as a boolean
and drops the pointer without releasing the reference.

highbank_init() has the same issue for the Calxeda system registers
node after mapping it with of_iomap(). of_iomap() does not consume the
device node reference.

Release both node references after the corresponding use.

Fixes: 7a2848d369b2 ("ARM: highbank: abstract out SCU usage")
Fixes: 26cae166cff9 ("ARM: highbank: remove custom .init_time hook")
Signed-off-by: Yuho Choi <dbgh9129 at gmail.com>
---
 arch/arm/mach-highbank/highbank.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 47335c7dadf8..430f1ca125d3 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -50,10 +50,15 @@ static void highbank_l2c310_write_sec(unsigned long val, unsigned reg)
 
 static void __init highbank_init_irq(void)
 {
+	struct device_node *np;
+
 	irqchip_init();
 
-	if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
+	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9");
+	if (np) {
+		of_node_put(np);
 		highbank_scu_map_io();
+	}
 }
 
 static void highbank_power_off(void)
@@ -141,6 +146,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);
 
 	register_platform_power_off(highbank_power_off);
-- 
2.43.0




More information about the linux-arm-kernel mailing list