Re: [PATCH v2 2/7] HID: lenovo: Fix lenovo_led_set_tp10ubkbd() error handling

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

 



On Sat, 20 Feb 2021 13:24:33 +0100
Hans de Goede <hdegoede@xxxxxxxxxx> wrote:

> Fix the following issues with lenovo_led_set_tp10ubkbd() error handling:
> 
> 1. On success hid_hw_raw_request() returns the number of bytes send.

bytes sent

> @@ -75,10 +75,12 @@ static void lenovo_led_set_tp10ubkbd(struct hid_device *hdev, u8 led_code,
>  	data->led_report[2] = value ? TP10UBKBD_LED_ON : TP10UBKBD_LED_OFF;
>  	ret = hid_hw_raw_request(hdev, data->led_report[0], data->led_report, 3,
>  				 HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
> -	if (ret)
> +	if (ret != 3 && ret != -ENODEV)
>  		hid_err(hdev, "Set LED output report error: %d\n", ret);
>  
>  	mutex_unlock(&data->led_report_mutex);
> +
> +	return ret < 0 ? ret : 0;

So if ret == 2, it will log error but return 0. I think in that case it
should return -EIO.



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux