Re: [PATCH v1] ARM: OMAP2+: Fix OF node reference leaks in omap_hwmod
From: Andreas Kemnade
Date: Sun Jun 07 2026 - 01:53:58 EST
On Mon, 4 May 2026 12:47:11 -0400
Yuho Choi <dbgh9129@xxxxxxxxx> wrote:
> 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 <dbgh9129@xxxxxxxxx>
Reviewed-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>