aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/wmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/wmi.c')
-rw-r--r--drivers/platform/x86/wmi.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index e4eaa14ed987..b2978a04317f 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -518,8 +518,13 @@ static void wmi_notify_debug(u32 value, void *context)
518{ 518{
519 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; 519 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
520 union acpi_object *obj; 520 union acpi_object *obj;
521 acpi_status status;
521 522
522 wmi_get_event_data(value, &response); 523 status = wmi_get_event_data(value, &response);
524 if (status != AE_OK) {
525 printk(KERN_INFO "wmi: bad event status 0x%x\n", status);
526 return;
527 }
523 528
524 obj = (union acpi_object *)response.pointer; 529 obj = (union acpi_object *)response.pointer;
525 530
@@ -543,6 +548,7 @@ static void wmi_notify_debug(u32 value, void *context)
543 default: 548 default:
544 printk("object type 0x%X\n", obj->type); 549 printk("object type 0x%X\n", obj->type);
545 } 550 }
551 kfree(obj);
546} 552}
547 553
548/** 554/**
@@ -804,7 +810,7 @@ static bool guid_already_parsed(const char *guid_string)
804/* 810/*
805 * Parse the _WDG method for the GUID data blocks 811 * Parse the _WDG method for the GUID data blocks
806 */ 812 */
807static __init acpi_status parse_wdg(acpi_handle handle) 813static acpi_status parse_wdg(acpi_handle handle)
808{ 814{
809 struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; 815 struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
810 union acpi_object *obj; 816 union acpi_object *obj;
@@ -827,8 +833,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
827 total = obj->buffer.length / sizeof(struct guid_block); 833 total = obj->buffer.length / sizeof(struct guid_block);
828 834
829 gblock = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL); 835 gblock = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL);
830 if (!gblock) 836 if (!gblock) {
831 return AE_NO_MEMORY; 837 status = AE_NO_MEMORY;
838 goto out_free_pointer;
839 }
832 840
833 for (i = 0; i < total; i++) { 841 for (i = 0; i < total; i++) {
834 /* 842 /*
@@ -848,8 +856,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
848 wmi_dump_wdg(&gblock[i]); 856 wmi_dump_wdg(&gblock[i]);
849 857
850 wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); 858 wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL);
851 if (!wblock) 859 if (!wblock) {
852 return AE_NO_MEMORY; 860 status = AE_NO_MEMORY;
861 goto out_free_gblock;
862 }
853 863
854 wblock->gblock = gblock[i]; 864 wblock->gblock = gblock[i];
855 wblock->handle = handle; 865 wblock->handle = handle;
@@ -860,8 +870,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
860 list_add_tail(&wblock->list, &wmi_blocks.list); 870 list_add_tail(&wblock->list, &wmi_blocks.list);
861 } 871 }
862 872
863 kfree(out.pointer); 873out_free_gblock:
864 kfree(gblock); 874 kfree(gblock);
875out_free_pointer:
876 kfree(out.pointer);
865 877
866 return status; 878 return status;
867} 879}
@@ -947,7 +959,7 @@ static int acpi_wmi_remove(struct acpi_device *device, int type)
947 return 0; 959 return 0;
948} 960}
949 961
950static int __init acpi_wmi_add(struct acpi_device *device) 962static int acpi_wmi_add(struct acpi_device *device)
951{ 963{
952 acpi_status status; 964 acpi_status status;
953 int result = 0; 965 int result = 0;