cpuidle: call cpuidle_get_driver() from after taking cpuidle_driver_lock
[firefly-linux-kernel-4.4.55.git] / drivers / cpuidle / driver.c
index a930005d5a3af15c49666a97272b139ce41a24f1..2458a741ad4566eebfa19bb22ceb667c4e7419c9 100644 (file)
@@ -338,10 +338,11 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
  */
 void cpuidle_driver_unref(void)
 {
-       struct cpuidle_driver *drv = cpuidle_get_driver();
+       struct cpuidle_driver *drv;
 
        spin_lock(&cpuidle_driver_lock);
 
+       drv = cpuidle_get_driver();
        if (drv && !WARN_ON(drv->refcnt <= 0))
                drv->refcnt--;