Messages in this thread Patch in this message | | | From | Eduardo Valentin <> | Subject | [PATCH 5/5] drivers: thermal: add check when unregistering cpu cooling | Date | Fri, 23 Aug 2013 18:03:16 -0400 |
| |
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> --- drivers/thermal/cpu_cooling.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 82e15db..429a98c 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -496,8 +496,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--; -- 1.8.2.1.342.gfa7285d
| |