summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPankaj Dubey <pankaj.dubey@samsung.com>2015-11-13 10:29:36 +0100
committerKrzysztof Kozlowski <k.kozlowski@samsung.com>2015-11-17 05:32:56 +0100
commitce36f6ad862fc3bc2466c89de17694e582a778b5 (patch)
tree4d46f511e6b7db8c625b611e9640d3276b2ec0bd
parentLinux 4.4-rc1 (diff)
downloadlinux-ce36f6ad862fc3bc2466c89de17694e582a778b5.tar.xz
linux-ce36f6ad862fc3bc2466c89de17694e582a778b5.zip
ARM: EXYNOS: Fix potential NULL pointer access in exynos_sys_powerdown_conf
If no platform devices binded to the driver but driver itself loaded and exynos_sys_powerdown_conf is called from arch/arm/mach-exynos/{suspend.c, pm.c} it will result in NULL pointer access, to prevent this added check on pmu_context for NULL. Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
-rw-r--r--arch/arm/mach-exynos/pmu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index de68938ee6aa..c21e41dad19c 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -748,8 +748,12 @@ static void exynos5_powerdown_conf(enum sys_powerdown mode)
void exynos_sys_powerdown_conf(enum sys_powerdown mode)
{
unsigned int i;
+ const struct exynos_pmu_data *pmu_data;
+
+ if (!pmu_context)
+ return;
- const struct exynos_pmu_data *pmu_data = pmu_context->pmu_data;
+ pmu_data = pmu_context->pmu_data;
if (pmu_data->powerdown_conf)
pmu_data->powerdown_conf(mode);