All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: ziniu.wang_1@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH 4/4] mmc: sdhci-esdhc-imx: disable irq during suspend to fix unhandled interrupt
Date: Tue, 23 Jun 2026 07:41:27 +0000	[thread overview]
Message-ID: <20260623074127.EFF821F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260623073515.2658205-5-ziniu.wang_1@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unbalanced disable_irq() on suspend and resume early error paths permanently breaks the controller.
--

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

mmc: sdhci-esdhc-imx: disable irq during suspend to fix unhandled interrupt

This commit fixes an "irq xxx: nobody cared" warning by unconditionally
disabling the usdhc interrupt during suspend and re-enabling it during
resume.

> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index a3688c94cf580..9afb74cac5599 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -2076,9 +2076,10 @@ static int sdhci_esdhc_suspend(struct device *dev)
>  	if (mmc_card_keep_power(host->mmc) && esdhc_is_usdhc(imx_data))
>  		sdhc_esdhc_tuning_save(host);
>  
> +	/* The irqs of imx are not shared. It is safe to disable */
> +	disable_irq(host->irq);
> +
>  	if (device_may_wakeup(dev)) {
> -		/* The irqs of imx are not shared. It is safe to disable */
> -		disable_irq(host->irq);
>  		ret = sdhci_enable_irq_wakeups(host);
>  		if (!ret)
>  			dev_warn(dev, "Failed to enable irq wakeup\n");

[Severity: High]
If pinctrl_pm_select_sleep_state() fails in the else branch below, does this
leave the IRQ permanently disabled?

If device_may_wakeup(dev) is false, sdhci_esdhc_suspend() can return early:

    if (device_may_wakeup(dev)) {
        ...
    } else {
        ret = pinctrl_pm_select_sleep_state(dev);
        if (ret)
            return ret;
    }

Since the PM core won't invoke the resume callback if suspend fails, it looks
like the disabled IRQ state is leaked. Should we re-enable the IRQ before
returning the error?

[ ... ]

> @@ -2127,10 +2128,10 @@ static int sdhci_esdhc_resume(struct device *dev)
>  	/* re-initialize hw state in case it's lost in low power mode */
>  	sdhci_esdhc_imx_hwinit(host);
>  
> -	if (host->irq_wake_enabled) {
> +	if (host->irq_wake_enabled)
>  		sdhci_disable_irq_wakeups(host);
> -		enable_irq(host->irq);
> -	}
> +
> +	enable_irq(host->irq);

[Severity: High]
Does this also affect early error returns in sdhci_esdhc_resume()?

Earlier in this function, there are error returns:

    ret = pinctrl_pm_select_default_state(dev);
    if (ret)
        return ret;

Now that disable_irq() is unconditional during suspend, do we need to ensure
the IRQ is re-enabled even if we return early here, or is it expected that
the controller remains broken if resume fails?

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

      reply	other threads:[~2026-06-23  7:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  7:35 [PATCH 0/4] mmc: sdhci-esdhc-imx: fix SDIO suspend/resume issues ziniu.wang_1
2026-06-23  7:35 ` [PATCH 1/4] mmc: sdhci-esdhc-imx: remove unnecessary mmc_card_wake_sdio_irq check for tuning save/restore ziniu.wang_1
2026-06-23  7:45   ` sashiko-bot
2026-06-23  7:35 ` [PATCH 2/4] mmc: sdhci-esdhc-imx: restore DLL override for DDR modes on resume ziniu.wang_1
2026-06-23  7:47   ` sashiko-bot
2026-06-23  7:35 ` [PATCH 3/4] mmc: sdhci-esdhc-imx: restore pinctrl before restoring ios timing " ziniu.wang_1
2026-06-23  7:47   ` sashiko-bot
2026-06-23  7:35 ` [PATCH 4/4] mmc: sdhci-esdhc-imx: disable irq during suspend to fix unhandled interrupt ziniu.wang_1
2026-06-23  7:41   ` 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=20260623074127.EFF821F000E9@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.