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 <shenying@motorola.com>
Reviewed-by: Zonghua Liu <a17671@motorola.com>
Reviewed-by: Qiong Xie <xieq2@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/2808715
Reviewed-by: Zhenghai Pan <panzh2@lenovo.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
This commit is contained in:
yangcj 2023-03-10 15:47:49 +08:00 • committed by Xiaojun Ji
commit ae805cb0ad

View file

@ -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);
}