|
@@ -285,6 +285,9 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
|
|
|
int ret, i;
|
|
|
struct cpuidle_driver *drv = cpuidle_get_driver();
|
|
|
|
|
|
+ if (!dev)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
if (dev->enabled)
|
|
|
return 0;
|
|
|
if (!drv || !cpuidle_curr_governor)
|
|
@@ -369,8 +372,6 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
|
|
|
struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
|
|
|
struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
|
|
|
|
|
|
- if (!dev)
|
|
|
- return -EINVAL;
|
|
|
if (!try_module_get(cpuidle_driver->owner))
|
|
|
return -EINVAL;
|
|
|
|
|
@@ -395,6 +396,9 @@ int cpuidle_register_device(struct cpuidle_device *dev)
|
|
|
{
|
|
|
int ret;
|
|
|
|
|
|
+ if (!dev)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
mutex_lock(&cpuidle_lock);
|
|
|
|
|
|
if ((ret = __cpuidle_register_device(dev))) {
|