From: sashiko-bot@kernel.org
To: ziniu.wang_1@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v4 7/7] mmc: sdhci-esdhc-imx: fix resume error handling
Date: Fri, 03 Jul 2026 11:32:56 +0000 [thread overview]
Message-ID: <20260703113257.06CCB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260703104208.3426374-8-ziniu.wang_1@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] The early return on `pm_runtime_force_resume()` failure intentionally skips software teardowns, leading to permanent resource leaks and IRQ depth nesting.
- [High] The patch's error handling fails to prevent a kernel panic, as the panic is simply deferred to the MMC child device resume.
Pre-existing issues:
- [High] `sdhci_esdhc_imx_remove()` ignores the return value of `pm_runtime_get_sync()`, leading to a kernel panic on device removal if clocks fail to enable.
--
commit 2ca3586c0fc9237c4716073c7d74f73e6e520449
Author: Luke Wang <ziniu.wang_1@nxp.com>
mmc: sdhci-esdhc-imx: fix resume error handling
This commit checks the return value of pm_runtime_force_resume() in
sdhci_esdhc_resume(). If it fails, the code returns immediately,
intentionally skipping some software teardown steps to prevent accessing
unclocked hardware registers which would cause a kernel panic.
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 6920f0425508d..586a1debf0981 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -2124,12 +2124,12 @@ static int sdhci_esdhc_resume(struct device *dev)
> dev_warn(dev, "Failed to restore pinctrl state\n");
> }
>
> - pm_runtime_force_resume(dev);
> -
> - ret = mmc_gpio_set_cd_wake(host->mmc, false);
> + ret = pm_runtime_force_resume(dev);
> + if (ret)
> + return ret;
[Severity: High]
If pm_runtime_force_resume() fails and we return early here, doesn't this
skip re-enabling the IRQ?
Since sdhci_esdhc_suspend() calls disable_irq(), skipping enable_irq()
leaves the interrupt permanently disabled and results in kernel warnings
due to an unbalanced wake depth on subsequent suspend cycles.
[Severity: High]
Does this early return actually prevent the kernel panic?
The PM core does not stop resuming child devices when a parent fails.
When the MMC class device resumes, it unblocks the block queue and calls
down into mmc_power_up(), which will access the unclocked
SDHCI_HOST_CONTROL register because __mmc_claim_host() ignores the
pm_runtime_get_sync() failure.
Should the code set host->flags |= SDHCI_DEVICE_DEAD before returning
the error so the MMC core is prevented from attempting to access the
unclocked hardware?
> +
> + mmc_gpio_set_cd_wake(host->mmc, false);
> +
> /* re-initialize hw state in case it's lost in low power mode */
> sdhci_esdhc_imx_hwinit(host);
>
[ ... ]
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a similar issue in
sdhci_esdhc_imx_remove():
drivers/mmc/host/sdhci-esdhc-imx.c:sdhci_esdhc_imx_remove() {
...
pm_runtime_get_sync(&pdev->dev);
dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
...
}
Since the return value of pm_runtime_get_sync() is ignored before accessing
hardware registers, could this also cause a synchronous external abort
on device removal if the clocks fail to enable?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260703104208.3426374-1-ziniu.wang_1@oss.nxp.com?part=7
prev parent reply other threads:[~2026-07-03 11:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 10:42 [PATCH v4 0/7] mmc: sdhci-esdhc-imx: fix SDIO suspend/resume issues ziniu.wang_1
2026-07-03 10:42 ` [PATCH v4 1/7] mmc: sdhci-esdhc-imx: remove unnecessary mmc_card_wake_sdio_irq check for tuning save/restore ziniu.wang_1
2026-07-05 8:48 ` Adrian Hunter
2026-07-03 10:42 ` [PATCH v4 2/7] mmc: sdhci-esdhc-imx: restore DLL override for DDR modes on resume ziniu.wang_1
2026-07-05 8:49 ` Adrian Hunter
2026-07-03 10:42 ` [PATCH v4 3/7] mmc: sdhci-esdhc-imx: restore pinctrl before restoring ios timing " ziniu.wang_1
2026-07-03 11:12 ` sashiko-bot
2026-07-05 8:14 ` Adrian Hunter
2026-07-06 3:25 ` Luke Wang (OSS)
2026-07-03 10:42 ` [PATCH v4 4/7] mmc: sdhci-esdhc-imx: disable irq during suspend to fix unhandled interrupt ziniu.wang_1
2026-07-05 8:30 ` Adrian Hunter
2026-07-06 6:21 ` Luke Wang (OSS)
2026-07-03 10:42 ` [PATCH v4 5/7] mmc: sdhci-esdhc-imx: use pm_runtime_resume_and_get() in suspend ziniu.wang_1
2026-07-03 11:18 ` sashiko-bot
2026-07-03 10:42 ` [PATCH v4 6/7] mmc: sdhci-esdhc-imx: make non-fatal errors non-blocking " ziniu.wang_1
2026-07-03 10:42 ` [PATCH v4 7/7] mmc: sdhci-esdhc-imx: fix resume error handling ziniu.wang_1
2026-07-03 11:32 ` sashiko-bot [this message]
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=20260703113257.06CCB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=ziniu.wang_1@oss.nxp.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.