platform/surface: surface3-wmi: Fix variable 'status' set but not used compiler warning
authorHans de Goede <hdegoede@redhat.com>
Thu, 4 Feb 2021 11:38:48 +0000 (12:38 +0100)
committerHans de Goede <hdegoede@redhat.com>
Thu, 4 Feb 2021 12:23:55 +0000 (13:23 +0100)
Explicitly check the status rather then relying on output.pointer staying
NULL on an error. This silences the following compiler warning:

drivers/platform/surface/surface3-wmi.c:60:14: warning: variable 'status' set but not used [-Wunused-but-set-variable]

Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210204113848.105994-1-hdegoede@redhat.com
drivers/platform/surface/surface3-wmi.c

index 130b6f5..fcd1d4f 100644 (file)
@@ -57,12 +57,16 @@ static DEFINE_MUTEX(s3_wmi_lock);
 static int s3_wmi_query_block(const char *guid, int instance, int *ret)
 {
        struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+       union acpi_object *obj = NULL;
        acpi_status status;
-       union acpi_object *obj;
        int error = 0;
 
        mutex_lock(&s3_wmi_lock);
        status = wmi_query_block(guid, instance, &output);
+       if (ACPI_FAILURE(status)) {
+               error = -EIO;
+               goto out_free_unlock;
+       }
 
        obj = output.pointer;