diff options
Diffstat (limited to 'drivers/hid/hid-logitech-dj.c')
-rw-r--r-- | drivers/hid/hid-logitech-dj.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 7800b1410562..2e5302462efb 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -461,7 +461,7 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, | |||
461 | struct hid_report *report; | 461 | struct hid_report *report; |
462 | struct hid_report_enum *output_report_enum; | 462 | struct hid_report_enum *output_report_enum; |
463 | u8 *data = (u8 *)(&dj_report->device_index); | 463 | u8 *data = (u8 *)(&dj_report->device_index); |
464 | int i; | 464 | unsigned int i; |
465 | 465 | ||
466 | output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; | 466 | output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; |
467 | report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT]; | 467 | report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT]; |
@@ -471,7 +471,7 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, | |||
471 | return -ENODEV; | 471 | return -ENODEV; |
472 | } | 472 | } |
473 | 473 | ||
474 | for (i = 0; i < report->field[0]->report_count; i++) | 474 | for (i = 0; i < DJREPORT_SHORT_LENGTH - 1; i++) |
475 | report->field[0]->value[i] = data[i]; | 475 | report->field[0]->value[i] = data[i]; |
476 | 476 | ||
477 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); | 477 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); |
@@ -791,6 +791,12 @@ static int logi_dj_probe(struct hid_device *hdev, | |||
791 | goto hid_parse_fail; | 791 | goto hid_parse_fail; |
792 | } | 792 | } |
793 | 793 | ||
794 | if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, REPORT_ID_DJ_SHORT, | ||
795 | 0, DJREPORT_SHORT_LENGTH - 1)) { | ||
796 | retval = -ENODEV; | ||
797 | goto hid_parse_fail; | ||
798 | } | ||
799 | |||
794 | /* Starts the usb device and connects to upper interfaces hiddev and | 800 | /* Starts the usb device and connects to upper interfaces hiddev and |
795 | * hidraw */ | 801 | * hidraw */ |
796 | retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | 802 | retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |