summaryrefslogtreecommitdiff
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)
{
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;
+ acpi_status status;
- wmi_get_event_data(value, &response);
+ status = wmi_get_event_data(value, &response);
+ if (status != AE_OK) {
+ printk(KERN_INFO "wmi: bad event status 0x%x\n", status);
+ return;
+ }
obj = (union acpi_object *)response.pointer;
@@ -543,6 +548,7 @@ static void wmi_notify_debug(u32 value, void *context)
default:
printk("object type 0x%X\n", obj->type);
}
+ kfree(obj);
}
/**
@@ -804,7 +810,7 @@ static bool guid_already_parsed(const char *guid_string)
/*
* Parse the _WDG method for the GUID data blocks
*/
-static __init acpi_status parse_wdg(acpi_handle handle)
+static acpi_status parse_wdg(acpi_handle handle)
{
struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
union acpi_object *obj;
@@ -827,8 +833,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
total = obj->buffer.length / sizeof(struct guid_block);
gblock = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL);
- if (!gblock)
- return AE_NO_MEMORY;
+ if (!gblock) {
+ status = AE_NO_MEMORY;
+ goto out_free_pointer;
+ }
for (i = 0; i < total; i++) {
/*
@@ -848,8 +856,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
wmi_dump_wdg(&gblock[i]);
wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL);
- if (!wblock)
- return AE_NO_MEMORY;
+ if (!wblock) {
+ status = AE_NO_MEMORY;
+ goto out_free_gblock;
+ }
wblock->gblock = gblock[i];
wblock->handle = handle;
@@ -860,8 +870,10 @@ static __init acpi_status parse_wdg(acpi_handle handle)
list_add_tail(&wblock->list, &wmi_blocks.list);
}
- kfree(out.pointer);
+out_free_gblock:
kfree(gblock);
+out_free_pointer:
+ kfree(out.pointer);
return status;
}
@@ -947,7 +959,7 @@ static int acpi_wmi_remove(struct acpi_device *device, int type)
return 0;
}
-static int __init acpi_wmi_add(struct acpi_device *device)
+static int acpi_wmi_add(struct acpi_device *device)
{
acpi_status status;
int result = 0;