Re: [PATCH v1] usb: core: Make use of acpi_evaluate_object() status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi! :-)

On 02/18/2020 07:09 PM, Andy Shevchenko wrote:

> 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: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/core/usb-acpi.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
> index f434a2060552..41b91f4c207d 100644
> --- a/drivers/usb/core/usb-acpi.c
> +++ b/drivers/usb/core/usb-acpi.c
[...]
> @@ -98,9 +98,11 @@ static enum usb_port_connect_type usb_acpi_get_connect_type(acpi_handle handle,
>  	 * no connectable, the port would be not used.
>  	 */
>  	status = acpi_evaluate_object(handle, "_UPC", NULL, &buffer);
> +	if (ACPI_FAILURE(status))
> +		goto out;
> +
>  	upc = buffer.pointer;
> -	if (!upc || (upc->type != ACPI_TYPE_PACKAGE)
> -		|| upc->package.count != 4) {
> +	if (!upc || (upc->type != ACPI_TYPE_PACKAGE) || upc->package.count != 4) {
>  		goto out;
>  	}

   I'd drop {} here, while at it.

MBR, Sergei



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux