On Sat, 20 Feb 2021 13:24:33 +0100
Hans de Goede [off-list ref] 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
quoted hunk ↗ jump to hunk
@@ -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.