On 5/21/24 22:04, linux-mmc@xxxxxxxxx wrote: > From: Daniel Kucera <linux-mmc@xxxxxxxxx> > > Signed-off-by: Daniel Kucera <linux-mmc@xxxxxxxxx> > --- > 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 Does that work for you? I vaguely remember adding some checks before the block device setup and some recovery as well since the partition scan (will fail) already triggered resets.