Re: [PATCH v2] memory: atmel-ebi: Disable SMC clock on probe failure
From: Alexandre Belloni
Date: Wed Nov 04 2026 - 16:25:09 EST
On 04/11/2026 19:59:45+0100, Krzysztof Kozlowski wrote:
> On 04/11/2026 19:53, Alexandre Belloni wrote:
> > Hi,
> >
> > On 01/11/2026 20:07:34+0100, Krzysztof Kozlowski wrote:
> >> Unprepare and drop the SMC clock reference, if probe fails to avoid
> >> resource leakage e.g. during probe deferral.
> >>
> >> There is no remove() callback, presumably on purpose so only error paths
> >> are handled.
> >>
> >> Cc: <stable@xxxxxxxxxxxxxxx>
> >> Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
> >> Reported-by: Wentao Liang <vulab@xxxxxxxxxxx>
> >> Closes: https://lore.kernel.org/all/20260917101623.2146392-1-vulab@xxxxxxxxxxx/
> >> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> >> Closes: https://sashiko.dev/#/bug/linux-8e236c81-01b2-4274-a213-11c3f31acfc2
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
> >>
> >> ---
> >>
> >> I independently developed the patch and then checked the queue with
> >> pending work of iscas. That one has issues and other complains from me,
> >> so only credits for the report.
> >>
> >> Changes in v2:
> >> 1. Handle of_platform_populate() error.
> >> ---
> >> drivers/memory/atmel-ebi.c | 27 ++++++++++++++++++++-------
> >> 1 file changed, 20 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> >> index 1e8e8aba2542..7dc2f7add1b1 100644
> >> --- a/drivers/memory/atmel-ebi.c
> >> +++ b/drivers/memory/atmel-ebi.c
> >> @@ -562,7 +562,7 @@ static int atmel_ebi_probe(struct platform_device *pdev)
> >> }
> >> ret = clk_prepare_enable(ebi->smc.clk);
> >> if (ret)
> >> - return ret;
> >> + goto err_put_clk;
> >>
> >
> > Couldn't we simply devm_clk_get_enabled() ?
> It is not this device's clock. Is there devm_clk_get_enabled() variant
> which takes from other node?
Right! Not that I know of.
Reviewed-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
>
> Best regards,
> Krzysztof
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com