diff mbox

platform/x86: wmi: Fix error handling in acpi_wmi_init()

Message ID 1500673686-32577-1-git-send-email-khoroshilov@ispras.ru (mailing list archive)
State Accepted, archived
Delegated to: Darren Hart
Headers show

Commit Message

Alexey Khoroshilov July 21, 2017, 9:48 p.m. UTC
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>
---
 drivers/platform/x86/wmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Darren Hart July 21, 2017, 11:43 p.m. UTC | #1
On Sat, Jul 22, 2017 at 12:48:06AM +0300, Alexey Khoroshilov wrote:
> 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>

Eeek. Thank you. Applied to fixes for 4.13.X.
diff mbox

Patch

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 1a764e311e11..e32ba575e8d9 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -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;
 }