Message ID | 1394063092-9048-7-git-send-email-alcooperx@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 7b5424f..a4b909d 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -2377,6 +2377,16 @@ static int mmc_blk_probe(struct mmc_card *card) struct mmc_blk_data *md, *part_md; char cap_str[10]; + + /* if the card is locked, don't bring up the block layer because + * all reads and writes will fail. + */ + if (mmc_card_locked(card)) { + pr_debug("%s: %s - Probe aborted because card is locked\n", + mmc_hostname(card->host), __func__); + return -ENODEV; + } + /* * Check that the card supports the command class(es) we need. */
A locked card will return an error for all reads/writes to the block device, so prevent the block layer from coming up until the card is unlocked. Signed-off-by: Al Cooper <alcooperx@gmail.com> --- drivers/mmc/card/block.c | 10 ++++++++++ 1 file changed, 10 insertions(+)