[CPUFREQ] acpi-cpufreq: add error handling for cpufreq_register_driver() error
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 14 Jul 2008 02:59:44 +0000 (11:59 +0900)
committerDave Jones <davej@redhat.com>
Thu, 9 Oct 2008 17:52:42 +0000 (13:52 -0400)
add error handling for cpufreq_register_driver() error

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: cpufreq@lists.linux.org.uk
Signed-off-by: Dave Jones <davej@redhat.com>
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c

index dd097b835839dd73d4139d807c23e8fca1648344..1def5b06fa4ab056ebe9d70e9935b319f9808ee6 100644 (file)
@@ -785,7 +785,11 @@ static int __init acpi_cpufreq_init(void)
        if (ret)
                return ret;
 
-       return cpufreq_register_driver(&acpi_cpufreq_driver);
+       ret = cpufreq_register_driver(&acpi_cpufreq_driver);
+       if (ret)
+               free_percpu(acpi_perf_data);
+
+       return ret;
 }
 
 static void __exit acpi_cpufreq_exit(void)
@@ -795,8 +799,6 @@ static void __exit acpi_cpufreq_exit(void)
        cpufreq_unregister_driver(&acpi_cpufreq_driver);
 
        free_percpu(acpi_perf_data);
-
-       return;
 }
 
 module_param(acpi_pstate_strict, uint, 0644);