1
0
Fork 0

staging: greybus: es2: Use kmemdup instead of kmalloc and memcpy

This patch replaces kmalloc and memcpy with kmemdup for duplication of
memory.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
sayli karnik 2016-10-16 14:19:48 +05:30 committed by Greg Kroah-Hartman
parent d0af1bd5f6
commit 9edae49285
1 changed files with 1 additions and 2 deletions

View File

@ -175,10 +175,9 @@ static int output_sync(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd)
u8 *data;
int retval;
data = kmalloc(size, GFP_KERNEL);
data = kmemdup(req, size, GFP_KERNEL);
if (!data)
return -ENOMEM;
memcpy(data, req, size);
retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
cmd,