aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-logitech-dj.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-logitech-dj.c')
-rw-r--r--drivers/hid/hid-logitech-dj.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 486dbde2ba2d..b7ba82960c79 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -238,13 +238,6 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
238 return; 238 return;
239 } 239 }
240 240
241 if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
242 (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
243 dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n",
244 __func__, dj_report->device_index);
245 return;
246 }
247
248 if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { 241 if (djrcv_dev->paired_dj_devices[dj_report->device_index]) {
249 /* The device is already known. No need to reallocate it. */ 242 /* The device is already known. No need to reallocate it. */
250 dbg_hid("%s: device is already known\n", __func__); 243 dbg_hid("%s: device is already known\n", __func__);
@@ -557,7 +550,7 @@ static int logi_dj_ll_raw_request(struct hid_device *hid,
557 if (!out_buf) 550 if (!out_buf)
558 return -ENOMEM; 551 return -ENOMEM;
559 552
560 if (count < DJREPORT_SHORT_LENGTH - 2) 553 if (count > DJREPORT_SHORT_LENGTH - 2)
561 count = DJREPORT_SHORT_LENGTH - 2; 554 count = DJREPORT_SHORT_LENGTH - 2;
562 555
563 out_buf[0] = REPORT_ID_DJ_SHORT; 556 out_buf[0] = REPORT_ID_DJ_SHORT;
@@ -690,6 +683,12 @@ static int logi_dj_raw_event(struct hid_device *hdev,
690 * device (via hid_input_report() ) and return 1 so hid-core does not do 683 * device (via hid_input_report() ) and return 1 so hid-core does not do
691 * anything else with it. 684 * anything else with it.
692 */ 685 */
686 if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
687 (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
688 dev_err(&hdev->dev, "%s: invalid device index:%d\n",
689 __func__, dj_report->device_index);
690 return false;
691 }
693 692
694 spin_lock_irqsave(&djrcv_dev->lock, flags); 693 spin_lock_irqsave(&djrcv_dev->lock, flags);
695 if (dj_report->report_id == REPORT_ID_DJ_SHORT) { 694 if (dj_report->report_id == REPORT_ID_DJ_SHORT) {