Skip to content

Commit 75c0758

Browse files
committed
acpi-cpufreq: Fail initialization if driver cannot be registered
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>
1 parent d3c345d commit 75c0758

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -986,12 +986,12 @@ static int __init acpi_cpufreq_init(void)
986986
{
987987
int ret;
988988

989+
if (acpi_disabled)
990+
return -ENODEV;
991+
989992
/* don't keep reloading if cpufreq_driver exists */
990993
if (cpufreq_get_current_driver())
991-
return 0;
992-
993-
if (acpi_disabled)
994-
return 0;
994+
return -EEXIST;
995995

996996
pr_debug("acpi_cpufreq_init\n");
997997

0 commit comments

Comments
 (0)