Re: [PATCH] clk: tegra: tegra124-emc: put EMC node on register failure

From: Brian Masney

Date: Wed Jul 08 2026 - 12:53:09 EST


On Wed, Jul 08, 2026 at 07:20:58PM +0800, Guangshuo Li wrote:
> tegra124_clk_register_emc() stores a device node reference returned by
> of_parse_phandle() in tegra->emc_node.
>
> If clk_register() fails, the function returns an error before that
> reference can be consumed and released by the normal runtime path. The
> tegra_clk_emc object is freed on this failure path, but freeing the
> object does not drop the OF node reference stored in it.
>
> Drop the EMC node reference before freeing the tegra_clk_emc object.
> of_node_put() is safe for a NULL node, so this also covers the case where
> the phandle is absent.
>
> Fixes: 2db04f16b589 ("clk: tegra: Add EMC clock driver")
> Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>

Reviewed-by: Brian Masney <bmasney@xxxxxxxxxx>