3ce66bc
From: Dirk Brandewie <dirk.brandewie@gmail.com>
3ce66bc
3ce66bc
If cpufreq_register_driver() fails just free memory that has been
3ce66bc
allocated and return. intel_pstate_exit() function is removed sine we
3ce66bc
are built-in only now there is no reason for a module exit proceedure.
3ce66bc
3ce66bc
Reported-by:Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
3ce66bc
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
3ce66bc
---
3ce66bc
 drivers/cpufreq/intel_pstate.c |   39 +++++++++++----------------------------
3ce66bc
 1 files changed, 11 insertions(+), 28 deletions(-)
3ce66bc
3ce66bc
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
3ce66bc
index 2bfd083..f6dd1e7 100644
3ce66bc
--- a/drivers/cpufreq/intel_pstate.c
3ce66bc
+++ b/drivers/cpufreq/intel_pstate.c
3ce66bc
@@ -750,37 +750,11 @@ static struct cpufreq_driver intel_pstate_driver = {
3ce66bc
 	.owner		= THIS_MODULE,
3ce66bc
 };
3ce66bc
 
3ce66bc
-static void intel_pstate_exit(void)
3ce66bc
-{
3ce66bc
-	int cpu;
3ce66bc
-
3ce66bc
-	sysfs_remove_group(intel_pstate_kobject,
3ce66bc
-				&intel_pstate_attr_group);
3ce66bc
-	debugfs_remove_recursive(debugfs_parent);
3ce66bc
-
3ce66bc
-	cpufreq_unregister_driver(&intel_pstate_driver);
3ce66bc
-
3ce66bc
-	if (!all_cpu_data)
3ce66bc
-		return;
3ce66bc
-
3ce66bc
-	get_online_cpus();
3ce66bc
-	for_each_online_cpu(cpu) {
3ce66bc
-		if (all_cpu_data[cpu]) {
3ce66bc
-			del_timer_sync(&all_cpu_data[cpu]->timer);
3ce66bc
-			kfree(all_cpu_data[cpu]);
3ce66bc
-		}
3ce66bc
-	}
3ce66bc
-
3ce66bc
-	put_online_cpus();
3ce66bc
-	vfree(all_cpu_data);
3ce66bc
-}
3ce66bc
-module_exit(intel_pstate_exit);
3ce66bc
-
3ce66bc
 static int __initdata no_load;
3ce66bc
 
3ce66bc
 static int __init intel_pstate_init(void)
3ce66bc
 {
3ce66bc
-	int rc = 0;
3ce66bc
+	int cpu, rc = 0;
3ce66bc
 	const struct x86_cpu_id *id;
3ce66bc
 
3ce66bc
 	if (no_load)
3ce66bc
@@ -805,7 +779,16 @@ static int __init intel_pstate_init(void)
3ce66bc
 	intel_pstate_sysfs_expose_params();
3ce66bc
 	return rc;
3ce66bc
 out:
3ce66bc
-	intel_pstate_exit();
3ce66bc
+	get_online_cpus();
3ce66bc
+	for_each_online_cpu(cpu) {
3ce66bc
+		if (all_cpu_data[cpu]) {
3ce66bc
+			del_timer_sync(&all_cpu_data[cpu]->timer);
3ce66bc
+			kfree(all_cpu_data[cpu]);
3ce66bc
+		}
3ce66bc
+	}
3ce66bc
+
3ce66bc
+	put_online_cpus();
3ce66bc
+	vfree(all_cpu_data);
3ce66bc
 	return -ENODEV;
3ce66bc
 }
3ce66bc
 device_initcall(intel_pstate_init);
3ce66bc
-- 
3ce66bc
1.7.7.6
3ce66bc