From 4a7b197ad28d71f9fac873f283b4408df3fdb287 Mon Sep 17 00:00:00 2001 From: Mithil Bavishi Date: Wed, 3 Jun 2026 22:40:48 -0700 Subject: [PATCH 1/2] ARM: OMAP2+: Add CFI type for omap4_finish_suspend With CONFIG_CFI enabled, OMAP4 can trap in omap4_enter_lowpower() because omap_pm_ops.finish_suspend points directly to the assembly routine omap4_finish_suspend, which lacks the expected KCFI type metadata. Annotate omap4_finish_suspend with SYM_TYPED_FUNC_START so the assembly routine carries the KCFI type metadata. Signed-off-by: Mithil Bavishi Reviewed-by: Nathan Chancellor Reviewed-by: Andreas Kemnade Link: https://patch.msgid.link/20260604054048.18980-1-bavishimithil@gmail.com Signed-off-by: Kevin Hilman (TI) --- arch/arm/mach-omap2/sleep44xx.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S index f09c9197808b..8b515f30072b 100644 --- a/arch/arm/mach-omap2/sleep44xx.S +++ b/arch/arm/mach-omap2/sleep44xx.S @@ -6,6 +6,7 @@ * Santosh Shilimkar */ +#include #include #include #include @@ -58,7 +59,7 @@ * stack frame and it expects the caller to take care of it. Hence the entire * stack frame is saved to avoid possible stack corruption. */ -ENTRY(omap4_finish_suspend) +SYM_TYPED_FUNC_START(omap4_finish_suspend) stmfd sp!, {r4-r12, lr} cmp r0, #0x0 beq do_WFI @ No lowpower state, jump to WFI @@ -223,7 +224,7 @@ skip_scu_gp_clear: isb dsb ldmfd sp!, {r4-r12, pc} -ENDPROC(omap4_finish_suspend) +SYM_FUNC_END(omap4_finish_suspend) /* * ============================ From 76103814279724e5c98b1c16a730f56ebede9f74 Mon Sep 17 00:00:00 2001 From: Yuho Choi Date: Mon, 4 May 2026 12:47:11 -0400 Subject: [PATCH 2/2] ARM: OMAP2+: Fix OF node reference leaks in omap_hwmod The OF helpers that return device nodes acquire references that must be released by the caller. _init() leaks the "ocp" bus node returned by of_find_node_by_name() on all paths after lookup, and also leaks the child returned by of_get_next_child() when parsing module flags. Route the post-lookup returns through a common cleanup path and release the child after use. omap_hwmod_setup_earlycon_flags() leaks the /chosen node and the UART node resolved from stdout-path. Track them separately and drop both references after use. Fixes: 1aa8f0cb19e5 ("ARM: OMAP2+: Remove unused legacy code for interconnects") Fixes: 4f2122473363 ("ARM: OMAP2+: Check also the first dts child for hwmod flags") Fixes: 8dd6666f4937 ("ARM: OMAP2+: omap_hwmod: Add support for earlycon") Signed-off-by: Yuho Choi Reviewed-by: Andreas Kemnade Link: https://patch.msgid.link/20260504164711.2854116-1-dbgh9129@gmail.com Signed-off-by: Kevin Hilman (TI) --- arch/arm/mach-omap2/omap_hwmod.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 974107ff18b4..03cd523dff87 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2331,13 +2331,15 @@ static int __init _init(struct omap_hwmod *oh, void *data) if (r < 0) { WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", oh->name); - return 0; + r = 0; + goto out_put_node; } r = _init_clocks(oh, np); if (r < 0) { WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); - return -EINVAL; + r = -EINVAL; + goto out_put_node; } if (np) { @@ -2345,13 +2347,19 @@ static int __init _init(struct omap_hwmod *oh, void *data) parse_module_flags(oh, np); child = of_get_next_child(np, NULL); - if (child) + if (child) { parse_module_flags(oh, child); + of_node_put(child); + } } oh->_state = _HWMOD_STATE_INITIALIZED; - return 0; + r = 0; + +out_put_node: + of_node_put(bus); + return r; } /** @@ -3608,13 +3616,13 @@ int omap_hwmod_init_module(struct device *dev, #ifdef CONFIG_SERIAL_EARLYCON static void __init omap_hwmod_setup_earlycon_flags(void) { - struct device_node *np; + struct device_node *np, *chosen; struct omap_hwmod *oh; const char *uart; - np = of_find_node_by_path("/chosen"); - if (np) { - uart = of_get_property(np, "stdout-path", NULL); + chosen = of_find_node_by_path("/chosen"); + if (chosen) { + uart = of_get_property(chosen, "stdout-path", NULL); if (uart) { np = of_find_node_by_path(uart); if (np) { @@ -3629,8 +3637,10 @@ static void __init omap_hwmod_setup_earlycon_flags(void) if (oh) oh->flags |= DEBUG_OMAPUART_FLAGS; } + of_node_put(np); } } + of_node_put(chosen); } #endif