Skip to content

Commit 66ff899

Browse files
intel-lab-lkpJiri Kosina
authored andcommitted
HID: fix memdup.cocci warnings
drivers/hid/hid-thrustmaster.c:300:27-34: WARNING opportunity for kmemdup Use kmemdup rather than duplicating its implementation Generated by: scripts/coccinelle/api/memdup.cocci Fixes: c49c336 ("HID: support for initialization of some Thrustmaster wheels") CC: Dario Pagani <[email protected]> Reported-by: kernel test robot <[email protected]> Signed-off-by: kernel test robot <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent dfe74f5 commit 66ff899

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/hid/hid-thrustmaster.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,13 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i
297297
goto error2;
298298
}
299299

300-
tm_wheel->model_request = kzalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
300+
tm_wheel->model_request = kmemdup(&model_request,
301+
sizeof(struct usb_ctrlrequest),
302+
GFP_KERNEL);
301303
if (!tm_wheel->model_request) {
302304
ret = -ENOMEM;
303305
goto error3;
304306
}
305-
memcpy(tm_wheel->model_request, &model_request, sizeof(struct usb_ctrlrequest));
306307

307308
tm_wheel->response = kzalloc(sizeof(struct tm_wheel_response), GFP_KERNEL);
308309
if (!tm_wheel->response) {

0 commit comments

Comments
 (0)