diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-08-26 03:14:48 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2010-10-21 09:36:46 -0400 |
commit | 2d5ab5551f38793f8977114d78a98aad138cfb4e (patch) | |
tree | ea9d19d0fefcecc8d8dc1a3ab541602bd18c68f9 /drivers/platform | |
parent | 5212cd678af82fef00f6d60d14de01c1211aad56 (diff) |
WMI: free wmi blocks when parse_wdg() fails
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/wmi.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 63d0b65deffb..8d59699f28e3 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -795,6 +795,16 @@ static bool guid_already_parsed(const char *guid_string) | |||
795 | return false; | 795 | return false; |
796 | } | 796 | } |
797 | 797 | ||
798 | static void free_wmi_blocks(void) | ||
799 | { | ||
800 | struct wmi_block *wblock, *next; | ||
801 | |||
802 | list_for_each_entry_safe(wblock, next, &wmi_blocks.list, list) { | ||
803 | list_del(&wblock->list); | ||
804 | kfree(wblock); | ||
805 | } | ||
806 | } | ||
807 | |||
798 | /* | 808 | /* |
799 | * Parse the _WDG method for the GUID data blocks | 809 | * Parse the _WDG method for the GUID data blocks |
800 | */ | 810 | */ |
@@ -853,7 +863,7 @@ static acpi_status parse_wdg(acpi_handle handle) | |||
853 | wblock->handle = handle; | 863 | wblock->handle = handle; |
854 | if (debug_event) { | 864 | if (debug_event) { |
855 | wblock->handler = wmi_notify_debug; | 865 | wblock->handler = wmi_notify_debug; |
856 | status = wmi_method_enable(wblock, 1); | 866 | wmi_method_enable(wblock, 1); |
857 | } | 867 | } |
858 | list_add_tail(&wblock->list, &wmi_blocks.list); | 868 | list_add_tail(&wblock->list, &wmi_blocks.list); |
859 | } | 869 | } |
@@ -863,6 +873,9 @@ out_free_gblock: | |||
863 | out_free_pointer: | 873 | out_free_pointer: |
864 | kfree(out.pointer); | 874 | kfree(out.pointer); |
865 | 875 | ||
876 | if (ACPI_FAILURE(status)) | ||
877 | free_wmi_blocks(); | ||
878 | |||
866 | return status; | 879 | return status; |
867 | } | 880 | } |
868 | 881 | ||
@@ -1002,19 +1015,11 @@ static int __init acpi_wmi_init(void) | |||
1002 | 1015 | ||
1003 | static void __exit acpi_wmi_exit(void) | 1016 | static void __exit acpi_wmi_exit(void) |
1004 | { | 1017 | { |
1005 | struct list_head *p, *tmp; | ||
1006 | struct wmi_block *wblock; | ||
1007 | |||
1008 | wmi_class_exit(); | 1018 | wmi_class_exit(); |
1009 | 1019 | ||
1010 | acpi_bus_unregister_driver(&acpi_wmi_driver); | 1020 | acpi_bus_unregister_driver(&acpi_wmi_driver); |
1011 | 1021 | ||
1012 | list_for_each_safe(p, tmp, &wmi_blocks.list) { | 1022 | free_wmi_blocks(); |
1013 | wblock = list_entry(p, struct wmi_block, list); | ||
1014 | |||
1015 | list_del(p); | ||
1016 | kfree(wblock); | ||
1017 | } | ||
1018 | 1023 | ||
1019 | printk(KERN_INFO PREFIX "Mapper unloaded\n"); | 1024 | printk(KERN_INFO PREFIX "Mapper unloaded\n"); |
1020 | } | 1025 | } |