[PATCH v2] clk: mvebu: ap-cpu: fix missing clk_put() in ap_cpu_clock_probe()
Brian Masney
bmasney at redhat.com
Tue Jun 16 12:22:07 PDT 2026
Hi Wentao,
On Tue, Jun 16, 2026 at 12:29:36PM +0000, Wentao Liang wrote:
> The function ap_cpu_clock_probe() calls of_clk_get() to obtain a
> reference to the parent clock for each CPU cluster, but it never
> releases it with clk_put(). The returned clk is used only to read
> the parent's name via __clk_get_name(), and the reference is leaked
> on every successful cluster initialization as well as on the error
> path when devm_clk_hw_register() fails.
>
> Rather than adding clk_put() calls, replace the of_clk_get() +
> __clk_get_name() pattern with of_clk_get_parent_name(), which is
> the intended API for this use case and handles the reference
> counting internally. This matches the pattern already used by the
> sibling drivers clk-cpu.c and clk-corediv.c.
>
> Fixes: af9617b419f7 ("clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths")
> Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
The Fixes commit you listed missed this, and yes it should have been
fixed there as well, however the Fixes tag needs to point to the commit
where the leak was first introduced. In this case, it is:
Fixes: f756e362d9384 ("clk: mvebu: add CPU clock driver for Armada 7K/8K")
With that fixed:
Reviewed-by: Brian Masney <bmasney at redhat.com>
More information about the linux-arm-kernel
mailing list