diff options
author | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-08-15 14:54:46 (GMT) |
---|---|---|
committer | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-09-03 13:10:34 (GMT) |
commit | 50e66c7ed8a1cd7e933628f9f5cf2617394adf5a (patch) | |
tree | 0b154f231362ca7886519f432f03f3b0a9eaf12b /drivers/thermal | |
parent | a8892d83894bcbd2717846cfa85955152b73453f (diff) | |
download | linux-50e66c7ed8a1cd7e933628f9f5cf2617394adf5a.tar.xz |
drivers: thermal: add check when unregistering cpu cooling
This patch avoids NULL pointer accesses while unregistering
cpu cooling devices, in case a NULL pointer is received.
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 5b3744e..d179028 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -498,8 +498,12 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register); */ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) { - struct cpufreq_cooling_device *cpufreq_dev = cdev->devdata; + struct cpufreq_cooling_device *cpufreq_dev; + if (!cdev) + return; + + cpufreq_dev = cdev->devdata; mutex_lock(&cooling_cpufreq_lock); cpufreq_dev_count--; |