* [PATCH] memory: atmel-ebi: Fix SMC clock reference leak in atmel_ebi_probe()
@ 2026-09-17 10:16 Wentao Liang
0 siblings, 0 replies; only message in thread
From: Wentao Liang @ 2026-09-17 10:16 UTC (permalink / raw)
To: alexandre.belloni
Cc: bbrezillon, claudiu.beznea, krzk, linux-arm-kernel, linux-kernel,
nicolas.ferre, Wentao Liang, stable
atmel_ebi_probe() takes a reference to the SMC clock with
of_clk_get(), stores it in ebi->smc.clk and enables it, but the
reference is never released: the driver has no remove callback and
none of the error paths after the clock has been enabled call
clk_put(), so the reference leaks on the success path and on every
error path.
Drop the reference with clk_put() once the clock has been prepared
and enabled. The clock itself stays enabled, as the driver needs it
to keep the SMC registers accessible.
Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/memory/atmel-ebi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index 8db970da9af9..cd138a3b793c 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -561,8 +561,13 @@ static int atmel_ebi_probe(struct platform_device *pdev)
ebi->smc.clk = NULL;
}
ret = clk_prepare_enable(ebi->smc.clk);
- if (ret)
+ if (ret) {
+ clk_put(ebi->smc.clk);
return ret;
+ }
+
+ /* The clock stays enabled; drop the unneeded consumer reference. */
+ clk_put(ebi->smc.clk);
/*
* The sama5d3 does not provide an EBICSA register and thus does need
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-17 10:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 10:16 [PATCH] memory: atmel-ebi: Fix SMC clock reference leak in atmel_ebi_probe() Wentao Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox