From ae805cb0adbb7fe08ae9e1e0865a464693d95ce3 Mon Sep 17 00:00:00 2001 From: yangcj Date: Fri, 10 Mar 2023 15:47:49 +0800 Subject: [PATCH] mmc: fix sdcard nullpoint exception port from: (CR) Symptom: host->card is null when call mmc_sd_suspend. Root Cause: the another process call mmc_remove_card,then host->card = NULL Solution: add host->card check when it used. Test result: The SD card functions normally Change-Id: Id3312d5be7403457a864e5ddc628fd4e6da0b459 Reviewed-on: https://gerrit.mot.com/2535590 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ying Shen Reviewed-by: Zonghua Liu Reviewed-by: Qiong Xie Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/2808715 Reviewed-by: Zhenghai Pan Reviewed-by: Huosheng Liao --- drivers/mmc/core/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 9607ff927ea4..5c5bc269916a 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1289,7 +1289,7 @@ static int mmc_sd_suspend(struct mmc_host *host) int err; err = _mmc_sd_suspend(host); - if (!err) { + if (!err && host->card) { pm_runtime_disable(&host->card->dev); pm_runtime_set_suspended(&host->card->dev); }