From d85f16835d366bcf34603b77ead9256a40a67a67 Mon Sep 17 00:00:00 2001 From: Wen Zhiwei Date: Wed, 29 Dec 2021 10:38:14 +0800 Subject: [PATCH] UPSTREAM: mmc: dw_mmc: Fix potential null pointer risk we previously assumed 'host->slot' could be null, null pointer judgment should be added Signed-off-by: Wen Zhiwei Reviewed-by: Jaehoon Chung Link: https://lore.kernel.org/r/20211229023814.53372-1-wenzhiwei@kylinos.cn Signed-off-by: Ulf Hansson Signed-off-by: Yifeng Zhao (cherry picked from commit 4a835afd808a3dbbac44bb399a902b822dc7445c) Change-Id: Iffade4e1d3ab6ad5bde7b6f05aaf3ce03ba28922 --- drivers/mmc/host/dw_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 205102e68be4..e763bb833330 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -3670,7 +3670,7 @@ int dw_mci_runtime_resume(struct device *dev) mci_writel(host, INTMASK, ret); } - if (host->slot->mmc->pm_flags & MMC_PM_KEEP_POWER) + if (host->slot && host->slot->mmc->pm_flags & MMC_PM_KEEP_POWER) dw_mci_set_ios(host->slot->mmc, &host->slot->mmc->ios); /* Force setup bus to guarantee available clock output */