Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 890bdeed authored by Asutosh Das's avatar Asutosh Das Committed by Xiaonian Wang
Browse files

mmc: sdhci-msm: fix possible NULL pointer dereference



The platform_get_resource API may return NULL, hence check
the return value before using the mapped memory.

Change-Id: I28741554f8e1b5843671ee0d6b08bdcf8e4469c9
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
parent 450745e4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2901,6 +2901,10 @@ static int sdhci_msm_probe(struct platform_device *pdev)
	/* Reset the core and Enable SDHC mode */
	core_memres = platform_get_resource_byname(pdev,
				IORESOURCE_MEM, "core_mem");
	if (!core_memres) {
		dev_err(&pdev->dev, "Failed to get iomem resource\n");
		goto vreg_deinit;
	}
	msm_host->core_mem = devm_ioremap(&pdev->dev, core_memres->start,
					resource_size(core_memres));