Skip to content

Commit

Permalink
HID: roccat: Use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Thomas Meyer authored and Jiri Kosina committed Nov 19, 2011
1 parent 1f59169 commit 4c33a88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions drivers/hid/hid-roccat-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ int roccat_common_send(struct usb_device *usb_dev, uint report_id,
char *buf;
int len;

buf = kmalloc(size, GFP_KERNEL);
buf = kmemdup(data, size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;

memcpy(buf, data, size);

len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
HID_REQ_SET_REPORT,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
Expand Down
4 changes: 1 addition & 3 deletions drivers/hid/hid-roccat-kone.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ static int kone_send(struct usb_device *usb_dev, uint usb_command,
char *buf;
int len;

buf = kmalloc(size, GFP_KERNEL);
buf = kmemdup(data, size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;

memcpy(buf, data, size);

len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
HID_REQ_SET_REPORT,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
Expand Down

0 comments on commit 4c33a88

Please sign in to comment.