Skip to contentSkip to conversation

cpuidle: checking the wrong variable in __cpuidle_register_device()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 9, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuidle: checking the wrong variable in __cpuidle_register_device()

We updated this in 8a25a2fd12 "cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem" but it should be checking "cpu_dev" here not "dev". The "dev" variable was dereferenced already.

drivers/cpuidle/cpuidle.c +1 -1
index 59f4261..7771810 100644
@@ -294,7 +294,7 @@ 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)
+	if (!cpu_dev)
 		return -EINVAL;
 	if (!try_module_get(cpuidle_driver->owner))
 		return -EINVAL;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dan Carpenter

We updated this in 8a25a2fd12 "cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem" but it should be checking "cpu_dev" here not "dev". The "dev" variable was dereferenced already.

drivers/cpuidle/cpuidle.c +0 -0
index 59f4261..7771810 100644

drivers/cpuidle/cpuidle.c static int __cpuidle_register_device(struct cpuidle_device *dev) · line 300

Quoted 8 lines
drivers/cpuidle/cpuidle.c +1 -1
@@ -294,7 +294,7 @@ 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)
+	if (!cpu_dev)
 		return -EINVAL;
 	if (!try_module_get(cpuidle_driver->owner))
 		return -EINVAL;