Signed-off-by: yanxiaoyong5 <yanxiaoyo...@gmail.com>
---
 drivers/mmc/core/sd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index fe914ff..73a1e68 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1247,8 +1247,13 @@ static int mmc_sd_runtime_resume(struct mmc_host *host)
 
 static int mmc_sd_hw_reset(struct mmc_host *host)
 {
-       mmc_power_cycle(host, host->card->ocr);
-       return mmc_sd_init_card(host, host->card->ocr, host->card);
+       struct mmc_card *card;
+
+       card = host->card;
+       if (!card)
+               return -EINVAL;
+       mmc_power_cycle(host, card->ocr);
+       return mmc_sd_init_card(host, card->ocr, host->card);
 }
 
 static const struct mmc_bus_ops mmc_sd_ops = {
-- 
2.7.4

Reply via email to