]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
cpuidle: call cpuidle_get_driver() from after taking cpuidle_driver_lock
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 3 Oct 2013 15:56:50 +0000 (21:26 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 30 Oct 2013 00:21:23 +0000 (01:21 +0100)
There are a few cpuidle_get_driver() calls that aren't made under
cpuidle_driver_lock which is incorrect.

Fix them by calling cpuidle_get_driver() after taking cpuidle_driver_lock.

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/driver.c
drivers/cpuidle/sysfs.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--;
 
index 8739cc05228ca97512a60b9cc3770097f3a044aa..a0223933536e2f6162936a5e76f9fc83be008925 100644 (file)
@@ -52,9 +52,10 @@ static ssize_t show_current_driver(struct device *dev,
                                   char *buf)
 {
        ssize_t ret;
-       struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
+       struct cpuidle_driver *cpuidle_driver;
 
        spin_lock(&cpuidle_driver_lock);
+       cpuidle_driver = cpuidle_get_driver();
        if (cpuidle_driver)
                ret = sprintf(buf, "%s\n", cpuidle_driver->name);
        else