Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kamal Dasu" <kamal.dasu@broadcom.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v11 6/6] mmc: core: Add support for resetting an eMMC at system resume
Date: Fri, 30 Oct 2026 18:29:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-191408@kernel.org> (raw)
In-Reply-To: <20261030181034.3811225-7-kamal.dasu@broadcom.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mmc: core: unchecked _mmc_hw_reset() error and premature active state in mmc_resume()
--

commit f67582c90bab341460117ecbfa06f572b7755129
Author: Ulf Hansson <ulf.hansson@oss.qualcomm.com>

mmc: core: Add support for resetting an eMMC at system resume

This commit adds support for the reset-card-at-resume DT property by setting
MMC_CAP2_RESET_AT_RESUME and MMC_PM_KEEP_POWER, and calling _mmc_hw_reset()
during mmc_resume().

> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index c183afbed30c8..793767c5159f2 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -2320,6 +2320,14 @@ static int mmc_resume(struct mmc_host *host)
>  	}
>  
>  	pm_runtime_enable(&host->card->dev);
> +
> +	if (mmc_card_keep_power(host) &&
> +	    host->caps2 & MMC_CAP2_RESET_AT_RESUME) {
> +		mmc_claim_host(host);
> +		_mmc_hw_reset(host);
> +		mmc_release_host(host);
> +	}

[Severity: Medium]
Should mmc_resume() check the return value of _mmc_hw_reset(host) and avoid
marking the card active before the reset succeeds?

Right now, when mmc_card_keep_power(host) is true, mmc_resume() unconditionally
marks the card runtime-active and clears the suspended state first:

drivers/mmc/core/mmc.c:mmc_resume() {
	if (mmc_card_keep_power(host)) {
		pm_runtime_set_active(&host->card->dev);
		mmc_card_clr_suspended(host->card);
	}
	pm_runtime_enable(&host->card->dev);
	...
}

After that, _mmc_hw_reset(host) resets or power-cycles the card, resets the
host IOS state to initial values via mmc_set_initial_state(host), and calls
mmc_init_card(host, card->ocr, card).

If mmc_init_card() fails (for example due to a command timeout, voltage or
timing switch failure, or tuning error), mmc_resume() discards the error and
returns 0 to mmc_bus_resume(). That suppresses the resume failure warning in
mmc_bus_resume() and leaves the card marked runtime-active and unsuspended
while the hardware remains in an uninitialized reset state, preventing a
subsequent runtime resume via _mmc_resume() from re-initializing the card.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261030181034.3811225-1-kamal.dasu@broadcom.com?part=6

      reply	other threads:[~2026-10-30 18:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 18:10 [PATCH v11 0/6] mmc: core: Keep the card powered across suspend when firmware needs it live Kamal Dasu
2026-10-30 18:10 ` [PATCH v11 1/6] dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO Kamal Dasu
2026-10-30 18:10 ` [PATCH v11 2/6] dt-bindings: mmc: Add reset-card-at-resume property Kamal Dasu
2026-10-30 18:10 ` [PATCH v11 3/6] mmc: core: Add option to keep an eMMC powered on at system suspend Kamal Dasu
2026-10-30 18:10 ` [PATCH v11 4/6] mmc: core: Split sdio_set_host_pm_flags() Kamal Dasu
2026-10-30 18:10 ` [PATCH v11 5/6] mmc: core: Move and split reset functions for eMMC Kamal Dasu
2026-10-30 18:10 ` [PATCH v11 6/6] mmc: core: Add support for resetting an eMMC at system resume Kamal Dasu
2026-10-30 18:29   ` 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=sashiko-outbox-191408@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kamal.dasu@broadcom.com \
    --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