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 5/5] mmc: sdhci-esdhc-imx: fix suspend/resume error handling
Date: Thu, 25 Jun 2026 11:08:58 +0000	[thread overview]
Message-ID: <20260625110859.EE8681F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260625105934.2890635-6-ziniu.wang_1@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Early return on pm_runtime_force_resume() failure bypasses critical software state cleanup, causing resource leaks and unbalanced IRQ/wakeup state.
--

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

mmc: sdhci-esdhc-imx: fix suspend/resume error handling

This commit updates the suspend and resume error handling paths in the
sdhci-esdhc-imx driver. It replaces pm_runtime_get_sync() with
pm_runtime_resume_and_get() in suspend, logs warnings instead of failing
for non-fatal errors, and adds a failure check for
pm_runtime_force_resume() in resume.

> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
[ ... ]
> @@ -2121,12 +2125,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: Medium]
Does this early return bypass critical cleanup steps that are required later
in the function?

When sdhci_esdhc_suspend() is called, it disables the interrupt using
disable_irq() and increments the runtime PM usage counter via
pm_runtime_resume_and_get(). 

If pm_runtime_force_resume() fails here and we return immediately, the
required enable_irq() and pm_runtime_put_autosuspend() calls at the end of
sdhci_esdhc_resume() are skipped.

Will this leave the interrupt depth unbalanced and leak the runtime PM usage
counter that was acquired during suspend?

>  
> +	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);
>

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

  reply	other threads:[~2026-06-25 11:09 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
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 [this message]
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=20260625110859.EE8681F000E9@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