[PATCH] ARM: OMAP2+: Fix a reference leak bug in omap_hwmod_fix_mpu_rt_idx()

Haoxiang Li <[email protected]> Tue, 23 Jun 2026 15:25:34 +0800
Newsgroups org.kernel.vger.linux-omap,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
omap_hwmod_fix_mpu_rt_idx() gets the first child node with
of_get_next_child(), which returns a node with its reference count
incremented. The function uses the child node to translate the MPU
runtime register resource, but never drops the reference afterwards.

Add the missing of_node_put() after of_address_to_resource().

Fixes: 1dbcb97c656e ("ARM: OMAP2+: Fix module address for modules using mpu_rt_idx")
Cc: [email protected]
Signed-off-by: Haoxiang Li <[email protected]>
---
 arch/arm/mach-omap2/omap_hwmod.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 974107ff18b4..1d7677ca3802 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2176,6 +2176,7 @@ static void omap_hwmod_fix_mpu_rt_idx(struct omap_hwmod *oh,
 	if (error)
 		pr_err("%s: error mapping mpu_rt_idx: %i\n",
 		       __func__, error);
+	of_node_put(child);
 }
 
 /**
-- 
2.25.1