platform/x86: acer-wmi: Using zero as first WMI instance number
authorLee, Chun-Yi <joeyli.kernel@gmail.com>
Tue, 20 Jun 2017 09:06:23 +0000 (17:06 +0800)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 20 Jun 2017 17:23:17 +0000 (20:23 +0300)
Pali Rohár found that there have some wmi query/evaluation
code that they used 'one' as the first WMI instance number.
But the number is indexed from zero that it's must less than
the instance_count in _WDG.

This patch changes those instance number from one to zero.

Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/acer-wmi.c

index 3b381178039bff524b5376f37265920daf6c8a70..1be71f956d5c2872a1c31d77482bf65ddcb733a1 100644 (file)
@@ -703,7 +703,7 @@ struct acpi_buffer *result)
        input.length = sizeof(struct wmab_args);
        input.pointer = (u8 *)regbuf;
 
-       status = wmi_evaluate_method(AMW0_GUID1, 1, 1, &input, result);
+       status = wmi_evaluate_method(AMW0_GUID1, 0, 1, &input, result);
 
        return status;
 }
@@ -968,7 +968,7 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
        u32 tmp = 0;
        acpi_status status;
 
-       status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result);
+       status = wmi_evaluate_method(WMID_GUID1, 0, method_id, &input, &result);
 
        if (ACPI_FAILURE(status))
                return status;
@@ -1282,7 +1282,7 @@ static acpi_status __init WMID_set_capabilities(void)
        acpi_status status;
        u32 devices;
 
-       status = wmi_query_block(WMID_GUID2, 1, &out);
+       status = wmi_query_block(WMID_GUID2, 0, &out);
        if (ACPI_FAILURE(status))
                return status;
 
@@ -2025,7 +2025,7 @@ static u32 get_wmid_devices(void)
        acpi_status status;
        u32 devices = 0;
 
-       status = wmi_query_block(WMID_GUID2, 1, &out);
+       status = wmi_query_block(WMID_GUID2, 0, &out);
        if (ACPI_FAILURE(status))
                return 0;