summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2021-05-11 13:30:33 +0200
committerJiri Kosina <jkosina@suse.cz>2021-06-25 14:11:01 +0200
commit3b770932eefb7c0c6319d332023efee87eb12913 (patch)
tree1166ed177ec2e321ff447865923a75f07868d1c4 /drivers/hid
parentHID: wacom: Correct base usage for capacitive ExpressKey status bits (diff)
downloadlinux-3b770932eefb7c0c6319d332023efee87eb12913.tar.xz
linux-3b770932eefb7c0c6319d332023efee87eb12913.zip
HID: thrustmaster: Switch to kmemdup() when allocate change_request
Use kmemdup() helper instead of open-coding to simplify the code when allocate change_request. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-thrustmaster.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/hid/hid-thrustmaster.c b/drivers/hid/hid-thrustmaster.c
index f643b1cb112d..cdc7d82ae9ed 100644
--- a/drivers/hid/hid-thrustmaster.c
+++ b/drivers/hid/hid-thrustmaster.c
@@ -311,12 +311,13 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i
goto error4;
}
- tm_wheel->change_request = kzalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ tm_wheel->change_request = kmemdup(&change_request,
+ sizeof(struct usb_ctrlrequest),
+ GFP_KERNEL);
if (!tm_wheel->change_request) {
ret = -ENOMEM;
goto error5;
}
- memcpy(tm_wheel->change_request, &change_request, sizeof(struct usb_ctrlrequest));
tm_wheel->usb_dev = interface_to_usbdev(to_usb_interface(hdev->dev.parent));
hid_set_drvdata(hdev, tm_wheel);