diff options
author | Fabien Parent <fparent@baylibre.com> | 2019-04-03 21:30:50 +0200 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2019-04-15 11:55:54 +0200 |
commit | b65be6355183f6cb82518d02a4067239f6175558 (patch) | |
tree | caa7ff2433c3a8aa75a83d359fa335a03e5ab843 /drivers/mmc/host/mtk-sd.c | |
parent | c278150e0d2a4ac0551f86c9db042665ad51c1e4 (diff) | |
download | linux-stable-b65be6355183f6cb82518d02a4067239f6175558.tar.gz linux-stable-b65be6355183f6cb82518d02a4067239f6175558.tar.bz2 linux-stable-b65be6355183f6cb82518d02a4067239f6175558.zip |
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 <fparent@baylibre.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/mtk-sd.c')
-rw-r--r-- | drivers/mmc/host/mtk-sd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index bd731bde4b75..0798f0ba6d34 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) |