mmc: block: fix partition switch failure observed during shutdown
If an RPMB request is the last request to be done before shutdown,
then the card will be already switched to legacy mode as part of
RPMB request handling. Later, in the shutdown handler, we get this
error if we try to switch to legacy mode again.
mmc0: failed to switch card to legacy mode: -74
CRs-Fixed: 935717
Change-Id: Ie75ba225412d0fecce9c98f07334b570a6cd5772
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 4c274d2..c150b2e 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -3293,18 +3293,19 @@
}
/* disable CQ mode in card */
- err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
- EXT_CSD_CMDQ, 0,
- card->ext_csd.generic_cmd6_time);
- if (err) {
- pr_err("%s: failed to switch card to legacy mode: %d\n",
- __func__, err);
- goto out;
- } else {
+ if (mmc_card_cmdq(card)) {
+ err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+ EXT_CSD_CMDQ, 0,
+ card->ext_csd.generic_cmd6_time);
+ if (err) {
+ pr_err("%s: failed to switch card to legacy mode: %d\n",
+ __func__, err);
+ goto out;
+ }
mmc_card_clr_cmdq(card);
- host->cmdq_ops->disable(host, false);
- host->card->cmdq_init = false;
}
+ host->cmdq_ops->disable(host, false);
+ host->card->cmdq_init = false;
out:
mmc_host_clk_release(host);
mmc_put_card(card);