From: sashiko-bot@kernel.org
To: "Robert Marko" <robert.marko@sartura.hr>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 2/6] mmc: sdhci-of-at91: add option to keep clocks enabled
Date: Mon, 07 Sep 2026 13:36:14 +0000 [thread overview]
Message-ID: <20260907133614.971BA1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260907132617.1198548-3-robert.marko@sartura.hr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Return values of mandatory clk_prepare_enable() calls are completely ignored in probe and resume paths
--
commit 6269754970c40ae19a0c5916bfacc745090e47c2
Author: Robert Marko <robert.marko@sartura.hr>
mmc: sdhci-of-at91: add option to keep clocks enabled
sdhci_at91_set_clks_presets() both enables the controller clocks and
programs its capabilities and preset registers. This prevents callers from
restoring the registers without changing the clock enable counts.
Move clock enablement to callers and add a SoC data flag for controllers
that must keep their clocks enabled. Use it in the runtime PM paths while
keeping register restoration separate from clock enablement.
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 7c4ac65f247d3..b7e2a89da348a 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
[ ... ]
> @@ -269,14 +266,23 @@ static int sdhci_at91_runtime_resume(struct device *dev)
> int ret;
>
> if (priv->restore_needed) {
> - ret = sdhci_at91_set_clks_presets(dev);
> - if (ret)
> - return ret;
> + if (!priv->soc_data->keep_clks_on)
> + clk_prepare_enable(priv->hclock);
> +
> + sdhci_at91_set_clks_presets(dev);
> +
> + if (!priv->soc_data->keep_clks_on) {
> + clk_prepare_enable(priv->mainck);
> + clk_prepare_enable(priv->gck);
> + }
[Severity: High]
This isn't a bug introduced by this patch, as the old implementation in
sdhci_at91_set_clks_presets() also ignored the return values. However, could
this cause a kernel panic if the clock enablement fails?
In drivers/mmc/host/sdhci-of-at91.c:sdhci_at91_runtime_resume(), if
clk_prepare_enable(priv->hclock) fails, the subsequent call to
sdhci_at91_set_clks_presets() will perform MMIO accesses to the SDHCI
controller without the clock being enabled. This can trigger a synchronous
external abort.
>
> priv->restore_needed = false;
> goto out;
> }
[ ... ]
> @@ -344,9 +350,10 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> return dev_err_probe(&pdev->dev, PTR_ERR(priv->gck),
> "failed to get multclk\n");
>
> - ret = sdhci_at91_set_clks_presets(&pdev->dev);
> - if (ret)
> - return ret;
> + clk_prepare_enable(priv->hclock);
> + sdhci_at91_set_clks_presets(&pdev->dev);
> + clk_prepare_enable(priv->mainck);
> + clk_prepare_enable(priv->gck);
[Severity: High]
This is a pre-existing issue, but this patch spreads the pattern to new
locations without adding error handling. Is it possible to check the return
values of clk_prepare_enable() here?
In drivers/mmc/host/sdhci-of-at91.c:sdhci_at91_probe(), if
clk_prepare_enable(priv->hclock) fails, the initialization will continue
and the MMIO accesses in sdhci_at91_set_clks_presets() will lead to a
system crash rather than a graceful failure of the probe function.
>
> priv->restore_needed = false;
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907132617.1198548-1-robert.marko@sartura.hr?part=2
next prev parent reply other threads:[~2026-09-07 13:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 13:25 [PATCH v2 0/6] mmc: sdhci-of-at91: add LAN969x support Robert Marko
2026-09-07 13:25 ` [PATCH v2 1/6] dt-bindings: mmc: atmel,sama5d2-sdhci: add LAN969x compatible Robert Marko
2026-09-07 13:25 ` [PATCH v2 2/6] mmc: sdhci-of-at91: add option to keep clocks enabled Robert Marko
2026-09-07 13:36 ` sashiko-bot [this message]
2026-09-09 10:31 ` Adrian Hunter
2026-09-07 13:25 ` [PATCH v2 3/6] mmc: sdhci-of-at91: add LAN969x support Robert Marko
2026-09-07 13:37 ` sashiko-bot
2026-09-09 10:36 ` Adrian Hunter
2026-09-07 13:25 ` [PATCH v2 4/6] arm64: dts: microchip: lan969x: add SDMMC nodes Robert Marko
2026-09-07 13:58 ` Aubin Constans
2026-09-07 13:25 ` [PATCH v2 5/6] arm64: dts: microchip: ev23x71a: enable QSPI Robert Marko
2026-09-07 13:33 ` sashiko-bot
2026-09-07 13:25 ` [PATCH v2 6/6] arm64: dts: microchip: ev23x71a: enable eMMC Robert Marko
2026-09-07 14:18 ` Aubin Constans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260907133614.971BA1F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robert.marko@sartura.hr \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox