ARM: EXYNOS: Handle of of_iomap() failure
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Fri, 27 Mar 2015 12:10:06 +0000 (13:10 +0100)
committerKukjin Kim <kgene@kernel.org>
Fri, 5 Jun 2015 17:17:55 +0000 (02:17 +0900)
Prevent possible NULL pointer dereference if of_iomap() fails.
Handle the error by skipping such power domain.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
arch/arm/mach-exynos/pm_domains.c

index a9686535f9ed460706a41a99dc60d6d4f575ab3b..b15f8663f9fc0e1351d53fd1897fa6d195ffea4f 100644 (file)
@@ -138,6 +138,14 @@ static __init int exynos4_pm_init_power_domain(void)
                pd->pd.name = kstrdup(dev_name(dev), GFP_KERNEL);
                pd->name = pd->pd.name;
                pd->base = of_iomap(np, 0);
+               if (!pd->base) {
+                       dev_warn(&pdev->dev, "Failed to map memory\n");
+                       kfree(pd->pd.name);
+                       kfree(pd);
+                       of_node_put(np);
+                       continue;
+               }
+
                pd->pd.power_off = exynos_pd_power_off;
                pd->pd.power_on = exynos_pd_power_on;
 
This page took 0.027265 seconds and 5 git commands to generate.