* [PATCH] ARM: mvebu: mvebu-soc-id: fix missing clk_put() on error path
@ 2026-10-08 17:14 Haotian Zhang
2026-10-08 18:08 ` Andrew Lunn
0 siblings, 1 reply; 2+ messages in thread
From: Haotian Zhang @ 2026-10-08 17:14 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Russell King, Arnd Bergmann, Jason Cooper
Cc: linux-arm-kernel, linux-kernel
get_soc_id_by_pci() takes a reference on the PCIe clock with
of_clk_get_by_name(), but when clk_prepare_enable() fails it jumps to
the clk_err label, which only drops the device node references and never
calls clk_put(). The struct clk and the clock core reference it holds
are leaked on that error path.
Release the clock reference before jumping to clk_err.
Fixes: af8d1c63afcb ("ARM: mvebu: Add support to get the ID and the revision of a SoC")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
arch/arm/mach-mvebu/mvebu-soc-id.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
index 850ed3ea3cc4..84831798357e 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.c
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.c
@@ -85,6 +85,7 @@ static int __init get_soc_id_by_pci(void)
ret = clk_prepare_enable(clk);
if (ret) {
pr_err("cannot enable clock\n");
+ clk_put(clk);
goto clk_err;
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: mvebu: mvebu-soc-id: fix missing clk_put() on error path
2026-10-08 17:14 [PATCH] ARM: mvebu: mvebu-soc-id: fix missing clk_put() on error path Haotian Zhang
@ 2026-10-08 18:08 ` Andrew Lunn
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2026-10-08 18:08 UTC (permalink / raw)
To: Haotian Zhang
Cc: Gregory Clement, Sebastian Hesselbarth, Russell King,
Arnd Bergmann, Jason Cooper, linux-arm-kernel, linux-kernel
On Fri, Oct 09, 2026 at 01:14:10AM +0800, Haotian Zhang wrote:
> get_soc_id_by_pci() takes a reference on the PCIe clock with
> of_clk_get_by_name(), but when clk_prepare_enable() fails it jumps to
> the clk_err label, which only drops the device node references and never
> calls clk_put(). The struct clk and the clock core reference it holds
> are leaked on that error path.
/*
* If the PCIe unit is actually enabled and we have PCI
* support in the kernel, we intentionally do not release the
* reference to the clock.
...
Given this comment, you need more detail in the commit message to
explain how your change and this comment goes together.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-08 18:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08 17:14 [PATCH] ARM: mvebu: mvebu-soc-id: fix missing clk_put() on error path Haotian Zhang
2026-10-08 18:08 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®