]> Git Repo - linux.git/commitdiff
drivers: thermal: add check when unregistering cpu cooling
authorEduardo Valentin <[email protected]>
Thu, 15 Aug 2013 14:54:46 +0000 (10:54 -0400)
committerEduardo Valentin <[email protected]>
Tue, 3 Sep 2013 13:10:34 +0000 (09:10 -0400)
This patch avoids NULL pointer accesses while unregistering
cpu cooling devices, in case a NULL pointer is received.

Cc: Zhang Rui <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
drivers/thermal/cpu_cooling.c

index 5b3744e7a95bb93348616c51ceaf00ae2326eee9..d17902886c3f28f31047b27f4ab52be0dceb67ec 100644 (file)
@@ -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--;
 
This page took 0.06469 seconds and 4 git commands to generate.