Commit 24f77240 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

usb: core: Make use of acpi_evaluate_object() status

Compiler is not happy about dangling variable:

.../core/usb-acpi.c: In function ‘usb_acpi_get_connect_type’:
.../core/usb-acpi.c:90:14: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
   90 |  acpi_status status;
      |              ^~~~~~

Make use of it by checking the status and bail out in case of error.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200218185207.62527-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 10892847
...@@ -86,7 +86,7 @@ static enum usb_port_connect_type usb_acpi_get_connect_type(acpi_handle handle, ...@@ -86,7 +86,7 @@ static enum usb_port_connect_type usb_acpi_get_connect_type(acpi_handle handle,
{ {
enum usb_port_connect_type connect_type = USB_PORT_CONNECT_TYPE_UNKNOWN; enum usb_port_connect_type connect_type = USB_PORT_CONNECT_TYPE_UNKNOWN;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *upc; union acpi_object *upc = NULL;
acpi_status status; acpi_status status;
/* /*
...@@ -98,11 +98,12 @@ static enum usb_port_connect_type usb_acpi_get_connect_type(acpi_handle handle, ...@@ -98,11 +98,12 @@ static enum usb_port_connect_type usb_acpi_get_connect_type(acpi_handle handle,
* no connectable, the port would be not used. * no connectable, the port would be not used.
*/ */
status = acpi_evaluate_object(handle, "_UPC", NULL, &buffer); status = acpi_evaluate_object(handle, "_UPC", NULL, &buffer);
if (ACPI_FAILURE(status))
goto out;
upc = buffer.pointer; upc = buffer.pointer;
if (!upc || (upc->type != ACPI_TYPE_PACKAGE) if (!upc || (upc->type != ACPI_TYPE_PACKAGE) || upc->package.count != 4)
|| upc->package.count != 4) {
goto out; goto out;
}
if (upc->package.elements[0].integer.value) if (upc->package.elements[0].integer.value)
if (pld->user_visible) if (pld->user_visible)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment