Skip to contentSkip to conversation

cpudile: optimize cpuidle_enable_device error handling

PATCH New gaurav jindal 1 participant 1 message Sep 1, 2017 CPU idle time management framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpudile: optimize cpuidle_enable_device error handling

do not fetch per cpu drv id cpuidle_curr_governor is NULL. if cpuidle_enable_device is NULL return -EIO. it prevents the addtional per cpu processing

---

drivers/cpuidle/cpuidle.c +4 -1
index 1519716..6464e09 100644
@@ -367,9 +367,12 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 	if (dev->enabled)
 		return 0;
 
+	if (!cpuidle_curr_governor)
+		return -EIO;
+
 	drv = cpuidle_get_cpu_driver(dev);
 
-	if (!drv || !cpuidle_curr_governor)
+	if (!drv)
 		return -EIO;
 
 	if (!dev->registered)