cpuidle: Fix NULL driver checking
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Thu, 1 Jun 2017 09:28:49 +0000 (11:28 +0200)
committerDouglas RAILLARD <douglas.raillard@arm.com>
Tue, 14 Aug 2018 15:32:08 +0000 (16:32 +0100)
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/cpuidle/driver.c

index dc32f34e68d9379dceee6f04795fe81473a8f9ca..efbae090964e811365a0bf0f46cb9695a2762fc4 100644 (file)
@@ -274,9 +274,11 @@ EXPORT_SYMBOL_GPL(cpuidle_register_driver);
  */
 void cpuidle_unregister_driver(struct cpuidle_driver *drv)
 {
-       spin_lock(&cpuidle_driver_lock);
-       __cpuidle_unregister_driver(drv);
-       spin_unlock(&cpuidle_driver_lock);
+       if (drv) {
+               spin_lock(&cpuidle_driver_lock);
+               __cpuidle_unregister_driver(drv);
+               spin_unlock(&cpuidle_driver_lock);
+       }
 }
 EXPORT_SYMBOL_GPL(cpuidle_unregister_driver);