acpi-cpufreq: Fail initialization if driver cannot be registered
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 25 Oct 2013 14:22:47 +0000 (16:22 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 25 Oct 2013 14:22:47 +0000 (16:22 +0200)
Make acpi_cpufreq_init() return error codes when the driver cannot be
registered so that the module doesn't stay useless in memory and so
that acpi_cpufreq_exit() doesn't attempt to unregister things that
have never been registered when the module is unloaded.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/acpi-cpufreq.c

index d2c3253e015ee23f107d2d34333c6afa533ab7cf..506fd23c755069f1f1b1e81763335f8f79b0de37 100644 (file)
@@ -986,12 +986,12 @@ static int __init acpi_cpufreq_init(void)
 {
        int ret;
 
+       if (acpi_disabled)
+               return -ENODEV;
+
        /* don't keep reloading if cpufreq_driver exists */
        if (cpufreq_get_current_driver())
-               return 0;
-
-       if (acpi_disabled)
-               return 0;
+               return -EEXIST;
 
        pr_debug("acpi_cpufreq_init\n");