Skip to content

Commit 4d31535

Browse files
JiangJiasstorulf
authored andcommitted
mmc: sh_mmcif: Check for null res pointer
If there is no suitable resource, platform_get_resource() will return NULL. Therefore in order to avoid the dereference of the NULL pointer, it should be better to check the 'res'. Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Cc: stable@vger.kernel.org # v5.16+ Link: https://lore.kernel.org/r/20220119120006.1426964-1-jiasheng@iscas.ac.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 40c67c2 commit 4d31535

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/mmc/host/sh_mmcif.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ static int sh_mmcif_dma_slave_config(struct sh_mmcif_host *host,
405405
struct dma_slave_config cfg = { 0, };
406406

407407
res = platform_get_resource(host->pd, IORESOURCE_MEM, 0);
408+
if (!res)
409+
return -EINVAL;
410+
408411
cfg.direction = direction;
409412

410413
if (direction == DMA_DEV_TO_MEM) {

0 commit comments

Comments
 (0)