Commit 3b770932 authored by Yang Yingliang's avatar Yang Yingliang Committed by Jiri Kosina

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: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 424d8237
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment