diff options
author | Eduardo Valentin <eduardo.valentin@ti.com> | 2014-02-07 02:44:06 -0800 |
---|---|---|
committer | Diwakar Tundlam <dtundlam@nvidia.com> | 2014-02-13 15:09:14 -0800 |
commit | 29d1721d76c9e413ebcbcec202f6f656b1bed628 (patch) | |
tree | d7de236225d28bcff9a1a5ecdd66b8b3651576ea /drivers/thermal | |
parent | 889cdc9288af875835b25f071d6958259a4a5916 (diff) |
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.
Change-Id: I24bba42b2d2c638aa25d65262982e2dbdbce5f08
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>
Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com> # for the NVIDIA downstream kernel
Reviewed-on: http://git-master/r/356885
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.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 5b3744e7a95b..d17902886c3f 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--; |