aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/hp-wmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/hp-wmi.c')
-rw-r--r--drivers/platform/x86/hp-wmi.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 63c3e658a884..ad4c414dbfbc 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -134,10 +134,15 @@ static int hp_wmi_perform_query(int query, int write, int value)
134 134
135 obj = output.pointer; 135 obj = output.pointer;
136 136
137 if (!obj || obj->type != ACPI_TYPE_BUFFER) 137 if (!obj)
138 return -EINVAL; 138 return -EINVAL;
139 else if (obj->type != ACPI_TYPE_BUFFER) {
140 kfree(obj);
141 return -EINVAL;
142 }
139 143
140 bios_return = *((struct bios_return *)obj->buffer.pointer); 144 bios_return = *((struct bios_return *)obj->buffer.pointer);
145 kfree(obj);
141 if (bios_return.return_code > 0) 146 if (bios_return.return_code > 0)
142 return bios_return.return_code * -1; 147 return bios_return.return_code * -1;
143 else 148 else
@@ -333,17 +338,24 @@ static void hp_wmi_notify(u32 value, void *context)
333 static struct key_entry *key; 338 static struct key_entry *key;
334 union acpi_object *obj; 339 union acpi_object *obj;
335 int eventcode; 340 int eventcode;
341 acpi_status status;
336 342
337 wmi_get_event_data(value, &response); 343 status = wmi_get_event_data(value, &response);
344 if (status != AE_OK) {
345 printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
346 return;
347 }
338 348
339 obj = (union acpi_object *)response.pointer; 349 obj = (union acpi_object *)response.pointer;
340 350
341 if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) { 351 if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) {
342 printk(KERN_INFO "HP WMI: Unknown response received\n"); 352 printk(KERN_INFO "HP WMI: Unknown response received\n");
353 kfree(obj);
343 return; 354 return;
344 } 355 }
345 356
346 eventcode = *((u8 *) obj->buffer.pointer); 357 eventcode = *((u8 *) obj->buffer.pointer);
358 kfree(obj);
347 if (eventcode == 0x4) 359 if (eventcode == 0x4)
348 eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0, 360 eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0,
349 0); 361 0);
@@ -572,7 +584,7 @@ static int __init hp_wmi_init(void)
572 if (wmi_has_guid(HPWMI_EVENT_GUID)) { 584 if (wmi_has_guid(HPWMI_EVENT_GUID)) {
573 err = wmi_install_notify_handler(HPWMI_EVENT_GUID, 585 err = wmi_install_notify_handler(HPWMI_EVENT_GUID,
574 hp_wmi_notify, NULL); 586 hp_wmi_notify, NULL);
575 if (!err) 587 if (ACPI_SUCCESS(err))
576 hp_wmi_input_setup(); 588 hp_wmi_input_setup();
577 } 589 }
578 590