From: linux-mmc@danman.eu
To: linux-mmc@vger.kernel.org, ulf.hansson@linaro.org
Cc: Daniel Kucera <linux-mmc@danman.eu>
Subject: [PATCH] mmc: core: allow detection of locked cards
Date: Tue, 21 May 2024 23:04:55 +0200 [thread overview]
Message-ID: <20240521210455.543587-1-linux-mmc@danman.eu> (raw)
From: Daniel Kucera <linux-mmc@danman.eu>
Signed-off-by: Daniel Kucera <linux-mmc@danman.eu>
---
drivers/mmc/core/sd.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 1c8148cdd..b22c30348 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1475,9 +1475,22 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
goto free_card;
}
- err = mmc_sd_setup_card(host, card, oldcard != NULL);
- if (err)
- goto free_card;
+ u32 card_status;
+
+ err = mmc_send_status(card, &card_status);
+ if (err){
+ pr_err("%s: unable to get card status\n",
+ mmc_hostname(host));
+ goto free_card;
+ }
+
+ if (card_status & R1_CARD_IS_LOCKED){
+ pr_warn("%s: card is locked\n", mmc_hostname(host));
+ } else {
+ err = mmc_sd_setup_card(host, card, oldcard != NULL);
+ if (err)
+ goto free_card;
+ }
/*
* If the card has not been power cycled, it may still be using 1.8V
--
2.34.1
next reply other threads:[~2024-05-21 21:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 21:04 linux-mmc [this message]
2024-05-23 3:41 ` [PATCH] mmc: core: allow detection of locked cards Avri Altman
2024-05-23 8:29 ` Christian Loehle
2024-05-23 13:17 ` Daniel Kucera
2024-05-23 8:30 ` Christian Loehle
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=20240521210455.543587-1-linux-mmc@danman.eu \
--to=linux-mmc@danman.eu \
--cc=linux-mmc@vger.kernel.org \
--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