summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-17 22:43:40 (GMT)
committerJiri Kosina <jkosina@suse.cz>2011-11-19 23:42:42 (GMT)
commit4c33a885a5c8a9ad573249fa4ee4fb39af866599 (patch)
tree81493de9bc23d258c825d1bc0a89be950ed2a385 /drivers/hid
parent1f59169e191c62e66dda86ac2bc953c915c8dddf (diff)
downloadlinux-4c33a885a5c8a9ad573249fa4ee4fb39af866599.tar.xz
HID: roccat: Use kmemdup rather than duplicating its implementation
Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-roccat-common.c4
-rw-r--r--drivers/hid/hid-roccat-kone.c4
2 files changed, 2 insertions, 6 deletions
diff --git a/drivers/hid/hid-roccat-common.c b/drivers/hid/hid-roccat-common.c
index edf898d..f933221 100644
--- a/drivers/hid/hid-roccat-common.c
+++ b/drivers/hid/hid-roccat-common.c
@@ -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,
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index e2072af..40090d6 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -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,