platform/surface: surface3-wmi: Fix variable 'status' set but not used compiler warning
PATCH 1/1 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 <[email protected]>
Reviewed-by Maximilian Luz <[email protected]>
Signed-off-by Hans de Goede <[email protected]>
--- drivers/platform/surface/surface3-wmi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/surface/surface3-wmi.c +5 -1
@@ -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;
Signature · 1 line
2.29.2
Hi,
Quoted 8 lines · Hans de Goede
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 <[email protected]>Reviewed-by Maximilian Luz <[email protected]>Signed-off-by Hans de Goede <[email protected]>
I've added this patch to my review-hans branch, so it should show up in pdx86/for-next soon-ish.
Regards,
Hans
Quoted 27 lines
--- drivers/platform/surface/surface3-wmi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/platform/surface/surface3-wmi.c +5
-1@@ -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;