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>
This commit is contained in:
parent
d0af1bd5f6
commit
9edae49285
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue