diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-05-17 07:57:31 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-05-17 07:57:31 +0200 |
commit | 75d95d84888cbd0024eb62ca7e72b3f7fe67dbdd (patch) | |
tree | 7167fa30a5c46766c10c4b9a37d7bf9373c26c6d /drivers/usb/gadget/function/f_hid.c | |
parent | 52648e83c9a6b9f7fc3dd272d4d10175e93aa62a (diff) | |
parent | c0655fe9b0901a968800f56687be3c62b4cce5d2 (diff) | |
download | blackbird-obmc-linux-75d95d84888cbd0024eb62ca7e72b3f7fe67dbdd.tar.gz blackbird-obmc-linux-75d95d84888cbd0024eb62ca7e72b3f7fe67dbdd.zip |
Merge branch 'linus' into x86/asm, to resolve conflicts
Conflicts:
tools/testing/selftests/x86/Makefile
tools/testing/selftests/x86/run_x86_tests.sh
Diffstat (limited to 'drivers/usb/gadget/function/f_hid.c')
-rw-r--r-- | drivers/usb/gadget/function/f_hid.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 13dfc9915b1d..f7f35a36c09a 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c @@ -437,12 +437,20 @@ static int hidg_setup(struct usb_function *f, | USB_REQ_GET_DESCRIPTOR): switch (value >> 8) { case HID_DT_HID: + { + struct hid_descriptor hidg_desc_copy = hidg_desc; + VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: HID\n"); + hidg_desc_copy.desc[0].bDescriptorType = HID_DT_REPORT; + hidg_desc_copy.desc[0].wDescriptorLength = + cpu_to_le16(hidg->report_desc_length); + length = min_t(unsigned short, length, - hidg_desc.bLength); - memcpy(req->buf, &hidg_desc, length); + hidg_desc_copy.bLength); + memcpy(req->buf, &hidg_desc_copy, length); goto respond; break; + } case HID_DT_REPORT: VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: REPORT\n"); length = min_t(unsigned short, length, @@ -632,6 +640,10 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) hidg_fs_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); hidg_hs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); hidg_fs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); + /* + * We can use hidg_desc struct here but we should not relay + * that its content won't change after returning from this function. + */ hidg_desc.desc[0].bDescriptorType = HID_DT_REPORT; hidg_desc.desc[0].wDescriptorLength = cpu_to_le16(hidg->report_desc_length); |