aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpuidle/driver.c3
-rw-r--r--drivers/cpuidle/sysfs.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index a930005d5a3a..2458a741ad45 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -338,10 +338,11 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
338 */ 338 */
339void cpuidle_driver_unref(void) 339void cpuidle_driver_unref(void)
340{ 340{
341 struct cpuidle_driver *drv = cpuidle_get_driver(); 341 struct cpuidle_driver *drv;
342 342
343 spin_lock(&cpuidle_driver_lock); 343 spin_lock(&cpuidle_driver_lock);
344 344
345 drv = cpuidle_get_driver();
345 if (drv && !WARN_ON(drv->refcnt <= 0)) 346 if (drv && !WARN_ON(drv->refcnt <= 0))
346 drv->refcnt--; 347 drv->refcnt--;
347 348
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 8739cc05228c..a0223933536e 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -52,9 +52,10 @@ static ssize_t show_current_driver(struct device *dev,
52 char *buf) 52 char *buf)
53{ 53{
54 ssize_t ret; 54 ssize_t ret;
55 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); 55 struct cpuidle_driver *cpuidle_driver;
56 56
57 spin_lock(&cpuidle_driver_lock); 57 spin_lock(&cpuidle_driver_lock);
58 cpuidle_driver = cpuidle_get_driver();
58 if (cpuidle_driver) 59 if (cpuidle_driver)
59 ret = sprintf(buf, "%s\n", cpuidle_driver->name); 60 ret = sprintf(buf, "%s\n", cpuidle_driver->name);
60 else 61 else