From: Fabien Parent Date: Wed, 3 Apr 2019 19:30:50 +0000 (+0200) Subject: mmc: mtk-sd: check for valid optional memory resource X-Git-Tag: v5.4-rc1~1078^2~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b65be6355183f6cb82518d02a4067239f6175558;p=platform%2Fkernel%2Flinux-rpi.git mmc: mtk-sd: check for valid optional memory resource 'top_base' memory region is optional. Check that the resource is valid before using it. This avoid getting a "invalid resource" error message printed by the kernel. Signed-off-by: Fabien Parent Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index bd731bd..0798f0b 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -2134,9 +2134,11 @@ static int msdc_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - host->top_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(host->top_base)) - host->top_base = NULL; + if (res) { + host->top_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(host->top_base)) + host->top_base = NULL; + } ret = mmc_regulator_get_supply(mmc); if (ret)