aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorDirk Brandewie <dirk.brandewie@gmail.com>2013-03-05 17:15:27 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-03-06 17:34:58 -0500
commit907cc908108b16ae87b7165be992511c968159f0 (patch)
treedb9bf7f809c64ccb6678878ad6b828fef2d81395 /drivers/cpufreq
parent37530f2bda039774bd65aea14cc1d1dd26a82b9e (diff)
cpufreq / intel_pstate: Fix intel_pstate_init() error path
If cpufreq_register_driver() fails just free memory that has been allocated and return. intel_pstate_exit() function is removed since we are built-in only now there is no reason for a module exit procedure. Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/intel_pstate.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 096fde0ebcb5..46a23b65dfc8 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -747,37 +747,11 @@ static struct cpufreq_driver intel_pstate_driver = {
747 .owner = THIS_MODULE, 747 .owner = THIS_MODULE,
748}; 748};
749 749
750static void intel_pstate_exit(void)
751{
752 int cpu;
753
754 sysfs_remove_group(intel_pstate_kobject,
755 &intel_pstate_attr_group);
756 debugfs_remove_recursive(debugfs_parent);
757
758 cpufreq_unregister_driver(&intel_pstate_driver);
759
760 if (!all_cpu_data)
761 return;
762
763 get_online_cpus();
764 for_each_online_cpu(cpu) {
765 if (all_cpu_data[cpu]) {
766 del_timer_sync(&all_cpu_data[cpu]->timer);
767 kfree(all_cpu_data[cpu]);
768 }
769 }
770
771 put_online_cpus();
772 vfree(all_cpu_data);
773}
774module_exit(intel_pstate_exit);
775
776static int __initdata no_load; 750static int __initdata no_load;
777 751
778static int __init intel_pstate_init(void) 752static int __init intel_pstate_init(void)
779{ 753{
780 int rc = 0; 754 int cpu, rc = 0;
781 const struct x86_cpu_id *id; 755 const struct x86_cpu_id *id;
782 756
783 if (no_load) 757 if (no_load)
@@ -802,7 +776,16 @@ static int __init intel_pstate_init(void)
802 intel_pstate_sysfs_expose_params(); 776 intel_pstate_sysfs_expose_params();
803 return rc; 777 return rc;
804out: 778out:
805 intel_pstate_exit(); 779 get_online_cpus();
780 for_each_online_cpu(cpu) {
781 if (all_cpu_data[cpu]) {
782 del_timer_sync(&all_cpu_data[cpu]->timer);
783 kfree(all_cpu_data[cpu]);
784 }
785 }
786
787 put_online_cpus();
788 vfree(all_cpu_data);
806 return -ENODEV; 789 return -ENODEV;
807} 790}
808device_initcall(intel_pstate_init); 791device_initcall(intel_pstate_init);