aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-logitech-dj.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-06 12:30:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-06 12:30:36 -0400
commit22e04f6b4b04a8afe9af9239224591d06ba3b24d (patch)
tree9bb72350400153ab232e227a378f94e95ad27569 /drivers/hid/hid-logitech-dj.c
parentec0ad730802173ec17e942f4b652a1819b1025b2 (diff)
parent4e5a494e4b4ba7e6aa1a8a285e98e3665fcb396e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina: "Highlights: - conversion of HID subsystem to use devm-based resource management, from Benjamin Tissoires - i2c-hid support for DT bindings, from Benjamin Tissoires - much improved support for Win8-multitouch devices, from Benjamin Tissoires - cleanup of core code using common hidinput_input_event(), from David Herrmann - fix for bug in implement() access to the bit stream (causing oops) that has been present in the code for ages, but devices that are able to trigger it have started to appear only now, from Jiri Kosina - fixes for CVE-2013-2899, CVE-2013-2898, CVE-2013-2896, CVE-2013-2892, CVE-2013-2888 (all triggerable only by specially crafted malicious HW devices plugged into the system), from Kees Cook - hidraw oops fix, from Manoj Chourasia - various smaller fixes here and there, support for a bunch of new devices by various contributors" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (53 commits) HID: MAINTAINERS: add roccat drivers HID: hid-sensor-hub: change kmalloc + memcpy by kmemdup HID: hid-sensor-hub: move to devm_kzalloc HID: hid-sensor-hub: fix indentation accross the code HID: move HID_REPORT_TYPES closer to the report-definitions HID: check for NULL field when setting values HID: picolcd_core: validate output report details HID: sensor-hub: validate feature report details HID: ntrig: validate feature report details HID: pantherlord: validate output report details HID: hid-wiimote: print small buffers via %*phC HID: uhid: improve uhid example client HID: Correct the USB IDs for the new Macbook Air 6 HID: wiimote: add support for Guitar-Hero guitars HID: wiimote: add support for Guitar-Hero drums Input: introduce BTN/ABS bits for drums and guitars HID: battery: don't do DMA from stack HID: roccat: add support for KonePureOptical v2 HID: picolcd: Prevent NULL pointer dereference on _remove() HID: usbhid: quirk for N-Trig DuoSense Touch Screen ...
Diffstat (limited to 'drivers/hid/hid-logitech-dj.c')
-rw-r--r--drivers/hid/hid-logitech-dj.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index cd33084c7860..7800b1410562 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -619,7 +619,7 @@ static int logi_dj_ll_input_event(struct input_dev *dev, unsigned int type,
619 619
620 struct hid_field *field; 620 struct hid_field *field;
621 struct hid_report *report; 621 struct hid_report *report;
622 unsigned char data[8]; 622 unsigned char *data;
623 int offset; 623 int offset;
624 624
625 dbg_hid("%s: %s, type:%d | code:%d | value:%d\n", 625 dbg_hid("%s: %s, type:%d | code:%d | value:%d\n",
@@ -635,6 +635,13 @@ static int logi_dj_ll_input_event(struct input_dev *dev, unsigned int type,
635 return -1; 635 return -1;
636 } 636 }
637 hid_set_field(field, offset, value); 637 hid_set_field(field, offset, value);
638
639 data = hid_alloc_report_buf(field->report, GFP_ATOMIC);
640 if (!data) {
641 dev_warn(&dev->dev, "failed to allocate report buf memory\n");
642 return -1;
643 }
644
638 hid_output_report(field->report, &data[0]); 645 hid_output_report(field->report, &data[0]);
639 646
640 output_report_enum = &dj_rcv_hiddev->report_enum[HID_OUTPUT_REPORT]; 647 output_report_enum = &dj_rcv_hiddev->report_enum[HID_OUTPUT_REPORT];
@@ -645,8 +652,9 @@ static int logi_dj_ll_input_event(struct input_dev *dev, unsigned int type,
645 652
646 hid_hw_request(dj_rcv_hiddev, report, HID_REQ_SET_REPORT); 653 hid_hw_request(dj_rcv_hiddev, report, HID_REQ_SET_REPORT);
647 654
648 return 0; 655 kfree(data);
649 656
657 return 0;
650} 658}
651 659
652static int logi_dj_ll_start(struct hid_device *hid) 660static int logi_dj_ll_start(struct hid_device *hid)
@@ -801,10 +809,10 @@ static int logi_dj_probe(struct hid_device *hdev,
801 } 809 }
802 810
803 /* This is enabling the polling urb on the IN endpoint */ 811 /* This is enabling the polling urb on the IN endpoint */
804 retval = hdev->ll_driver->open(hdev); 812 retval = hid_hw_open(hdev);
805 if (retval < 0) { 813 if (retval < 0) {
806 dev_err(&hdev->dev, "%s:hdev->ll_driver->open returned " 814 dev_err(&hdev->dev, "%s:hid_hw_open returned error:%d\n",
807 "error:%d\n", __func__, retval); 815 __func__, retval);
808 goto llopen_failed; 816 goto llopen_failed;
809 } 817 }
810 818
@@ -821,7 +829,7 @@ static int logi_dj_probe(struct hid_device *hdev,
821 return retval; 829 return retval;
822 830
823logi_dj_recv_query_paired_devices_failed: 831logi_dj_recv_query_paired_devices_failed:
824 hdev->ll_driver->close(hdev); 832 hid_hw_close(hdev);
825 833
826llopen_failed: 834llopen_failed:
827switch_to_dj_mode_fail: 835switch_to_dj_mode_fail:
@@ -863,7 +871,7 @@ static void logi_dj_remove(struct hid_device *hdev)
863 871
864 cancel_work_sync(&djrcv_dev->work); 872 cancel_work_sync(&djrcv_dev->work);
865 873
866 hdev->ll_driver->close(hdev); 874 hid_hw_close(hdev);
867 hid_hw_stop(hdev); 875 hid_hw_stop(hdev);
868 876
869 /* I suppose that at this point the only context that can access 877 /* I suppose that at this point the only context that can access