Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/surface: surface3-wmi: Fix variable 'status' set but not used compiler warning

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

+5 -1
+5 -1
drivers/platform/surface/surface3-wmi.c
··· 57 57 static int s3_wmi_query_block(const char *guid, int instance, int *ret) 58 58 { 59 59 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 60 + union acpi_object *obj = NULL; 60 61 acpi_status status; 61 - union acpi_object *obj; 62 62 int error = 0; 63 63 64 64 mutex_lock(&s3_wmi_lock); 65 65 status = wmi_query_block(guid, instance, &output); 66 + if (ACPI_FAILURE(status)) { 67 + error = -EIO; 68 + goto out_free_unlock; 69 + } 66 70 67 71 obj = output.pointer; 68 72