From 52ff04a216287e1e36d4a3ac977867412b91df45 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Fri, 4 Dec 2020 06:36:00 +0900 Subject: mmc: initialize an err variable Initialize an err variable to 0. Signed-off-by: Jaehoon Chung Reported-by: Coverity (CID: 313548) Reviewed-by: Tom Rini --- drivers/mmc/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/mmc/mmc.c') diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 36aab50f64e..d67af80c011 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -2062,7 +2062,7 @@ static int mmc_select_hs400es(struct mmc *mmc) static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps) { - int err; + int err = 0; const struct mode_width_tuning *mwt; const struct ext_csd_bus_width *ecbw; -- cgit v1.2.3 From 8e2b0af7216d78b60fccb46a107a4a047938aea9 Mon Sep 17 00:00:00 2001 From: Stefan Bosch Date: Sat, 23 Jan 2021 13:37:41 +0100 Subject: mmc: fix response timeout after switch command After issuing the switch command: Wait until 'current state' of the card status becomes 'tran'. This prevents from response timeout at the next command because of 'current state' = 'data'. Signed-off-by: Stefan Bosch Reviewed-by: Jaehoon Chung --- drivers/mmc/mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/mmc/mmc.c') diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index d67af80c011..b4c8e7f293b 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -841,7 +841,8 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value, value); return -EIO; } - if (!ret && (status & MMC_STATUS_RDY_FOR_DATA)) + if (!ret && (status & MMC_STATUS_RDY_FOR_DATA) && + (status & MMC_STATUS_CURR_STATE) == MMC_STATE_TRANS) return 0; udelay(100); } while (get_timer(start) < timeout_ms); -- cgit v1.2.3