summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-09-27 16:20:38 +0530
committerZhang Rui <rui.zhang@intel.com>2012-09-28 08:23:21 +0800
commitc072fed95c9855a920c114d7fa3351f0f54ea06e (patch)
treeeefe9fd7ae447aea14a9c8c6341c3479d968df2b /drivers/thermal
parenta4b6fec977020a508ff04b05f0fa01221a4ecf29 (diff)
downloadop-kernel-dev-c072fed95c9855a920c114d7fa3351f0f54ea06e.zip
op-kernel-dev-c072fed95c9855a920c114d7fa3351f0f54ea06e.tar.gz
thermal: Exynos: Fix NULL pointer dereference in exynos_unregister_thermal()
exynos_unregister_thermal() is functional only when 'th_zone' is not NULL (ensured by the NULL checks). However, in the event it is NULL, it gets dereferenced in the for loop. This patch fixes this issue. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/exynos_thermal.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index e84acde..fd03e85 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -475,11 +475,14 @@ static void exynos_unregister_thermal(void)
{
int i;
- if (th_zone && th_zone->therm_dev)
+ if (!th_zone)
+ return;
+
+ if (th_zone->therm_dev)
thermal_zone_device_unregister(th_zone->therm_dev);
for (i = 0; i < th_zone->cool_dev_size; i++) {
- if (th_zone && th_zone->cool_dev[i])
+ if (th_zone->cool_dev[i])
cpufreq_cooling_unregister(th_zone->cool_dev[i]);
}
OpenPOWER on IntegriCloud