platform/x86: wmi: Fix error handling in acpi_wmi_init()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 21 Jul 2017 21:48:06 +0000 (00:48 +0300)
committerDarren Hart (VMware) <dvhart@infradead.org>
Fri, 21 Jul 2017 23:21:03 +0000 (16:21 -0700)
The order of resource deallocations is messed up in acpi_wmi_init().
It should be vice versa.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
drivers/platform/x86/wmi.c

index 1a764e3..e32ba57 100644 (file)
@@ -1252,12 +1252,12 @@ static int __init acpi_wmi_init(void)
 
        return 0;
 
-err_unreg_class:
-       class_unregister(&wmi_bus_class);
-
 err_unreg_bus:
        bus_unregister(&wmi_bus_type);
 
+err_unreg_class:
+       class_unregister(&wmi_bus_class);
+
        return error;
 }