WMI: initialize wmi_blocks.list even if ACPI is disabled
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 12 Feb 2008 04:52:01 +0000 (20:52 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 12 Feb 2008 04:52:01 +0000 (20:52 -0800)
Even if we don't want to register the WMI driver, we should initialize
the wmi_blocks list to be empty, since we don't want the wmi helper
functions to oops just because that basic list has not even been set up.

With this, "find_guid()" will happily return "not found" rather than
oopsing all over the place, and the callers will then just automatically
return false or AE_NOT_FOUND as appropriate.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/acpi/wmi.c

index 36b84ab418dd2448824c5c958043621760e0cdb0..457ed3d3f51cd3bcd7841eadc694e60c17404b30 100644 (file)
@@ -673,11 +673,11 @@ static int __init acpi_wmi_init(void)
 {
        acpi_status result;
 
 {
        acpi_status result;
 
+       INIT_LIST_HEAD(&wmi_blocks.list);
+
        if (acpi_disabled)
                return -ENODEV;
 
        if (acpi_disabled)
                return -ENODEV;
 
-       INIT_LIST_HEAD(&wmi_blocks.list);
-
        result = acpi_bus_register_driver(&acpi_wmi_driver);
 
        if (result < 0) {
        result = acpi_bus_register_driver(&acpi_wmi_driver);
 
        if (result < 0) {