linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: yanxiaoyong5 <yanxiaoyong5@gmail.com>
To: ulf.hansson@linaro.org, rrangel@chromium.org,
	avri.altman@wdc.com, kstewart@linuxfoundation.org,
	tglx@linutronix.de
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	yanxiaoyong5 <yanxiaoyong5@gmail.com>
Subject: [PATCH] mmc/core:fix mmc_sd_hw_reset oops mmc_sd_hw_reset function may be oops if the ejection of sd and the reset of sd simultaneously occur
Date: Fri,  1 May 2020 08:59:54 -0700	[thread overview]
Message-ID: <1588348794-4511-1-git-send-email-yanxiaoyong5@gmail.com> (raw)

Signed-off-by: yanxiaoyong5 <yanxiaoyong5@gmail.com>
---
 drivers/mmc/core/sd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index fe914ff..73a1e68 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1247,8 +1247,13 @@ static int mmc_sd_runtime_resume(struct mmc_host *host)
 
 static int mmc_sd_hw_reset(struct mmc_host *host)
 {
-	mmc_power_cycle(host, host->card->ocr);
-	return mmc_sd_init_card(host, host->card->ocr, host->card);
+	struct mmc_card *card;
+
+	card = host->card;
+	if (!card)
+		return -EINVAL;
+	mmc_power_cycle(host, card->ocr);
+	return mmc_sd_init_card(host, card->ocr, host->card);
 }
 
 static const struct mmc_bus_ops mmc_sd_ops = {
-- 
2.7.4


             reply	other threads:[~2020-05-01 16:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 15:59 yanxiaoyong5 [this message]
     [not found] ` <CAHQZ30Btybck2ts8FGru_GDP63e6-ZdxN_mF5Wbp4L1XeTPAtQ@mail.gmail.com>
     [not found]   ` <2020050201173899657320@gmail.com>
2020-05-06 16:30     ` Re: [PATCH] mmc/core:fix mmc_sd_hw_reset oops mmc_sd_hw_reset function may be oops if the ejection of sd and the reset of sd simultaneously occur Ulf Hansson

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=1588348794-4511-1-git-send-email-yanxiaoyong5@gmail.com \
    --to=yanxiaoyong5@gmail.com \
    --cc=avri.altman@wdc.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rrangel@chromium.org \
    --cc=tglx@linutronix.de \
    --cc=ulf.hansson@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).