Skip to contentSkip to conversation

cpufreq: remove double calls to moudle_get/put in userspace governor

PATCH New Dominik Brodowski 1 participant 1 message Sep 5, 2004 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: remove double calls to moudle_get/put in userspace governor

The cpufreq core properly gets and puts the modules it calls, including governors. So there's no need to keep the racy in-module calls in cpufreq_userspace denoting otherwise.

drivers/cpufreq/cpufreq_userspace.c +1 -2
diff -ruN linux-original/drivers/cpufreq/cpufreq_userspace.c linux/drivers/cpufreq/cpufreq_userspace.c
@@ -515,7 +515,7 @@
 	unsigned int cpu = policy->cpu;
 	switch (event) {
 	case CPUFREQ_GOV_START:
-		if ((!cpu_online(cpu)) || (!try_module_get(THIS_MODULE)))
+		if (!cpu_online(cpu))
 			return -EINVAL;
 		BUG_ON(!policy->cur);
 		down(&userspace_sem);
@@ -534,7 +534,6 @@
 		cpu_max_freq[cpu] = 0;
 		sysfs_remove_file (&policy->kobj, &freq_attr_scaling_setspeed.attr);
 		up(&userspace_sem);
-		module_put(THIS_MODULE);
 		break;
 	case CPUFREQ_GOV_LIMITS:
 		down(&userspace_sem);