Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: ziniu.wang_1@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v2 1/5] mmc: sdhci-esdhc-imx: remove unnecessary mmc_card_wake_sdio_irq check for tuning save/restore
Date: Thu, 25 Jun 2026 11:13:24 +0000	[thread overview]
Message-ID: <20260625111325.6ED441F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260625105934.2890635-2-ziniu.wang_1@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] If `pm_runtime_force_resume()` fails in `sdhci_esdhc_resume()`, the function returns early without cleaning up software resources, leaking a runtime PM usage counter and leaving the device IRQ permanently disabled.
--

commit 49c3beebc2517e065c8ac10ff38587704b7567c1
Author: Luke Wang <ziniu.wang_1@nxp.com>

mmc: sdhci-esdhc-imx: remove unnecessary mmc_card_wake_sdio_irq check for tuning save/restore

This commit removes the mmc_card_wake_sdio_irq check during suspend
and resume for SDIO devices, as power is maintained even without the
SDIO IRQ wake flag. This ensures tuning delay values are properly
saved and restored.

> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 18ecddd6df6f2..6526d65538de5 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c

[ ... ]

> @@ -2124,8 +2123,7 @@ static int sdhci_esdhc_resume(struct device *dev)
>  	 * restore the saved tuning delay value for the device which keep
>  	 * power during system PM.
>  	 */
> -	if (mmc_card_keep_power(host->mmc) && mmc_card_wake_sdio_irq(host->mmc) &&
> -	    esdhc_is_usdhc(imx_data))
> +	if (mmc_card_keep_power(host->mmc) && esdhc_is_usdhc(imx_data))
>  		sdhc_esdhc_tuning_restore(host);
>  
>  	pm_runtime_put_autosuspend(dev);

[Severity: High]
This is a pre-existing issue, but I noticed a potential resource leak in
sdhci_esdhc_resume(). Does an early return on pm_runtime_force_resume()
failure skip cleaning up software state?

During system suspend, sdhci_esdhc_suspend() increments the runtime PM
usage count and disables the device IRQ:

sdhci_esdhc_suspend() {
    ...
    ret = pm_runtime_resume_and_get(dev);
    if (ret)
        return ret;
    ...
    disable_irq(host->irq);
}

During system resume, if pm_runtime_force_resume() fails, the function
returns early:

sdhci_esdhc_resume() {
    ...
    ret = pm_runtime_force_resume(dev);
    if (ret)
        return ret;
    ...
    enable_irq(host->irq);
    ...
    pm_runtime_put_autosuspend(dev);
}

If the early return is taken, does this leave the IRQ permanently disabled
and the PM usage counter unbalanced, potentially preventing the device and
its parent power domains from entering low-power states?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260625105934.2890635-1-ziniu.wang_1@oss.nxp.com?part=1

  reply	other threads:[~2026-06-25 11:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 10:59 [PATCH v2 0/5] mmc: sdhci-esdhc-imx: fix SDIO suspend/resume issues ziniu.wang_1
2026-06-25 10:59 ` [PATCH v2 1/5] mmc: sdhci-esdhc-imx: remove unnecessary mmc_card_wake_sdio_irq check for tuning save/restore ziniu.wang_1
2026-06-25 11:13   ` sashiko-bot [this message]
2026-06-25 16:26   ` Frank Li
2026-06-25 10:59 ` [PATCH v2 2/5] mmc: sdhci-esdhc-imx: restore DLL override for DDR modes on resume ziniu.wang_1
2026-06-25 16:29   ` Frank Li
2026-06-25 10:59 ` [PATCH v2 3/5] mmc: sdhci-esdhc-imx: restore pinctrl before restoring ios timing " ziniu.wang_1
2026-06-25 11:17   ` sashiko-bot
2026-06-25 16:35   ` Frank Li
2026-06-26  6:03     ` Luke Wang (OSS)
2026-06-26  6:58       ` Bough Chen
2026-06-25 10:59 ` [PATCH v2 4/5] mmc: sdhci-esdhc-imx: disable irq during suspend to fix unhandled interrupt ziniu.wang_1
2026-06-25 16:37   ` Frank Li
2026-06-26  6:04     ` Luke Wang (OSS)
2026-06-25 10:59 ` [PATCH v2 5/5] mmc: sdhci-esdhc-imx: fix suspend/resume error handling ziniu.wang_1
2026-06-25 11:08   ` sashiko-bot
2026-06-25 16:39   ` Frank Li
2026-06-26  6:07     ` Luke Wang (OSS)

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=20260625111325.6ED441F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox