[PATCH] clk: mvebu: ap-cpu: fix missing clk_put() in ap_cpu_clock_probe()
Wentao Liang
vulab at iscas.ac.cn
Wed Jun 3 19:51:15 PDT 2026
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.
Add the missing clk_put() after the name has been extracted and
before returning on error to fix the leak.
Fixes: af9617b419f7 ("clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths")
Cc: stable at vger.kernel.org
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
drivers/clk/mvebu/ap-cpu-clk.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/mvebu/ap-cpu-clk.c b/drivers/clk/mvebu/ap-cpu-clk.c
index 1e44ace7d951..a8175908e353 100644
--- a/drivers/clk/mvebu/ap-cpu-clk.c
+++ b/drivers/clk/mvebu/ap-cpu-clk.c
@@ -328,9 +328,11 @@ static int ap_cpu_clock_probe(struct platform_device *pdev)
ret = devm_clk_hw_register(dev, &ap_cpu_clk[cluster_index].hw);
if (ret) {
of_node_put(dn);
+ clk_put(parent);
return ret;
}
ap_cpu_data->hws[cluster_index] = &ap_cpu_clk[cluster_index].hw;
+ clk_put(parent);
}
ap_cpu_data->num = cluster_index + 1;
--
2.34.1
More information about the linux-arm-kernel
mailing list