diff options
author | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-08-15 10:54:46 -0400 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2014-09-26 16:45:44 +0800 |
commit | d49a5d426a7906927351ca58dd14c6870975b166 (patch) | |
tree | 92c75cc8d104700597d9f1e32486644b2ede4d74 | |
parent | e6ac9c53208c2871e3704e5b911971522cda8a56 (diff) |
drivers: thermal: add check when unregistering cpu coolingv3.10/topic/thermal-framework
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>
(cherry picked from commit 50e66c7ed8a1cd7e933628f9f5cf2617394adf5a)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
-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 8c1547424502..4246262c4bd2 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -549,8 +549,12 @@ EXPORT_SYMBOL_GPL(of_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--; |