diff options
Diffstat (limited to 'drivers/platform/x86/wmi.c')
-rw-r--r-- | drivers/platform/x86/wmi.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 81552bca6ae..f6e85c8122d 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -475,7 +475,7 @@ const struct acpi_buffer *in) | |||
475 | } | 475 | } |
476 | EXPORT_SYMBOL_GPL(wmi_set_block); | 476 | EXPORT_SYMBOL_GPL(wmi_set_block); |
477 | 477 | ||
478 | static void wmi_dump_wdg(struct guid_block *g) | 478 | static void wmi_dump_wdg(const struct guid_block *g) |
479 | { | 479 | { |
480 | char guid_string[37]; | 480 | char guid_string[37]; |
481 | 481 | ||
@@ -812,7 +812,7 @@ static acpi_status parse_wdg(acpi_handle handle) | |||
812 | { | 812 | { |
813 | struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; | 813 | struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; |
814 | union acpi_object *obj; | 814 | union acpi_object *obj; |
815 | struct guid_block *gblock; | 815 | const struct guid_block *gblock; |
816 | struct wmi_block *wblock; | 816 | struct wmi_block *wblock; |
817 | char guid_string[37]; | 817 | char guid_string[37]; |
818 | acpi_status status; | 818 | acpi_status status; |
@@ -832,14 +832,9 @@ static acpi_status parse_wdg(acpi_handle handle) | |||
832 | goto out_free_pointer; | 832 | goto out_free_pointer; |
833 | } | 833 | } |
834 | 834 | ||
835 | gblock = (const struct guid_block *)obj->buffer.pointer; | ||
835 | total = obj->buffer.length / sizeof(struct guid_block); | 836 | total = obj->buffer.length / sizeof(struct guid_block); |
836 | 837 | ||
837 | gblock = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL); | ||
838 | if (!gblock) { | ||
839 | status = AE_NO_MEMORY; | ||
840 | goto out_free_pointer; | ||
841 | } | ||
842 | |||
843 | for (i = 0; i < total; i++) { | 838 | for (i = 0; i < total; i++) { |
844 | /* | 839 | /* |
845 | Some WMI devices, like those for nVidia hooks, have a | 840 | Some WMI devices, like those for nVidia hooks, have a |
@@ -860,7 +855,7 @@ static acpi_status parse_wdg(acpi_handle handle) | |||
860 | wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); | 855 | wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); |
861 | if (!wblock) { | 856 | if (!wblock) { |
862 | status = AE_NO_MEMORY; | 857 | status = AE_NO_MEMORY; |
863 | goto out_free_gblock; | 858 | goto out_free_pointer; |
864 | } | 859 | } |
865 | 860 | ||
866 | wblock->gblock = gblock[i]; | 861 | wblock->gblock = gblock[i]; |
@@ -872,8 +867,6 @@ static acpi_status parse_wdg(acpi_handle handle) | |||
872 | list_add_tail(&wblock->list, &wmi_blocks.list); | 867 | list_add_tail(&wblock->list, &wmi_blocks.list); |
873 | } | 868 | } |
874 | 869 | ||
875 | out_free_gblock: | ||
876 | kfree(gblock); | ||
877 | out_free_pointer: | 870 | out_free_pointer: |
878 | kfree(out.pointer); | 871 | kfree(out.pointer); |
879 | 872 | ||