aboutsummaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorkernel test robot <lkp@intel.com>2021-03-25 23:49:56 +0800
committerJiri Kosina <jkosina@suse.cz>2021-03-30 09:44:31 +0200
commit66ff89946e6a71e48acaecfd5190038922b8e96a (patch)
tree163e32bf10b214407705b6e4bfee534ac9acd654 /drivers/hid
parentdfe74f550810cf7480d8759956d850ce40512f7a (diff)
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: c49c33637802 ("HID: support for initialization of some Thrustmaster wheels") CC: Dario Pagani <dario.pagani.146@gmail.com> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: kernel test robot <lkp@intel.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 bfcd08759ba0..d38304a35199 100644
--- a/drivers/hid/hid-thrustmaster.c
+++ b/drivers/hid/hid-thrustmaster.c
@@ -297,12 +297,13 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i
goto error2;
}
- tm_wheel->model_request = kzalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ tm_wheel->model_request = kmemdup(&model_request,
+ sizeof(struct usb_ctrlrequest),
+ GFP_KERNEL);
if (!tm_wheel->model_request) {
ret = -ENOMEM;
goto error3;
}
- memcpy(tm_wheel->model_request, &model_request, sizeof(struct usb_ctrlrequest));
tm_wheel->response = kzalloc(sizeof(struct tm_wheel_response), GFP_KERNEL);
if (!tm_wheel->response) {