Skip to content

Commit

Permalink
mmc: mtk-sd: check for valid optional memory resource
Browse files Browse the repository at this point in the history
'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>
  • Loading branch information
Fabien Parent authored and Ulf Hansson committed Apr 15, 2019
1 parent c278150 commit b65be63
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/mmc/host/mtk-sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b65be63

Please sign in to comment.