diff options
| author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2016-11-21 05:48:40 -0500 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2016-11-23 11:42:43 -0500 |
| commit | 061232f0d47fa10103f3efa3e890f002a930d902 (patch) | |
| tree | ff59d12a801d43e418b4dcfa6490433cc67c5d23 | |
| parent | 1ffb3c40ffb5c51bc39736409b11816c4260218e (diff) | |
HID: lg: make transfer buffers DMA capable
Kernel v4.9 strictly enforces DMA capable buffers, so we need to remove
buffers allocated on the stack.
[jkosina@suse.cz: fix up second usage of hid_hw_raw_request(), spotted by
0day build bot]
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| -rw-r--r-- | drivers/hid/hid-lg.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index 76f644deb0a7..c5c5fbe9d605 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c | |||
| @@ -756,11 +756,16 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 756 | 756 | ||
| 757 | /* Setup wireless link with Logitech Wii wheel */ | 757 | /* Setup wireless link with Logitech Wii wheel */ |
| 758 | if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) { | 758 | if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) { |
| 759 | unsigned char buf[] = { 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 759 | const unsigned char cbuf[] = { 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| 760 | u8 *buf = kmemdup(cbuf, sizeof(cbuf), GFP_KERNEL); | ||
| 760 | 761 | ||
| 761 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), | 762 | if (!buf) { |
| 762 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 763 | ret = -ENOMEM; |
| 764 | goto err_free; | ||
| 765 | } | ||
| 763 | 766 | ||
| 767 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), | ||
| 768 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | ||
| 764 | if (ret >= 0) { | 769 | if (ret >= 0) { |
| 765 | /* insert a little delay of 10 jiffies ~ 40ms */ | 770 | /* insert a little delay of 10 jiffies ~ 40ms */ |
| 766 | wait_queue_head_t wait; | 771 | wait_queue_head_t wait; |
| @@ -772,9 +777,10 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 772 | buf[1] = 0xB2; | 777 | buf[1] = 0xB2; |
| 773 | get_random_bytes(&buf[2], 2); | 778 | get_random_bytes(&buf[2], 2); |
| 774 | 779 | ||
| 775 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), | 780 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), |
| 776 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 781 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); |
| 777 | } | 782 | } |
| 783 | kfree(buf); | ||
| 778 | } | 784 | } |
| 779 | 785 | ||
| 780 | if (drv_data->quirks & LG_FF) | 786 | if (drv_data->quirks & LG_FF) |
