[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211229023814.53372-1-wenzhiwei@kylinos.cn>
Date: Wed, 29 Dec 2021 10:38:14 +0800
From: Wen Zhiwei <wenzhiwei@...inos.cn>
To: jh80.chung@...sung.com, ulf.hansson@...aro.org,
p.zabel@...gutronix.de, wenzhiwei@...inos.cn
Cc: linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] 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 <wenzhiwei@...inos.cn>
---
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 d977f34f6b55..c9dc8c168efb 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -3518,7 +3518,7 @@ int dw_mci_runtime_resume(struct device *dev)
mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE);
- 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 */
--
2.30.0
Powered by blists - more mailing lists