Commit 45c7a490 authored by Jaehoon Chung's avatar Jaehoon Chung Committed by Ulf Hansson

mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference

platform_get_resource can be returned the NULL pointer.
Then regs->start should be referred to NULL Pointer.
devm_ioremap_resource() checks whether res is NULL or not.
Signed-off-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 07d9a380
...@@ -46,12 +46,13 @@ int dw_mci_pltfm_register(struct platform_device *pdev, ...@@ -46,12 +46,13 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
host->pdata = pdev->dev.platform_data; host->pdata = pdev->dev.platform_data;
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
/* Get registers' physical base address */
host->phy_regs = regs->start;
host->regs = devm_ioremap_resource(&pdev->dev, regs); host->regs = devm_ioremap_resource(&pdev->dev, regs);
if (IS_ERR(host->regs)) if (IS_ERR(host->regs))
return PTR_ERR(host->regs); return PTR_ERR(host->regs);
/* Get registers' physical base address */
host->phy_regs = regs->start;
platform_set_drvdata(pdev, host); platform_set_drvdata(pdev, host);
return dw_mci_probe(host); return dw_mci_probe(host);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment