From: sayli karnik Date: Sun, 16 Oct 2016 08:49:48 +0000 (+0530) Subject: staging: greybus: es2: Use kmemdup instead of kmalloc and memcpy X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9edae49285051dc9312392df0d07c85f236a4d4b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c index 071bb1cfd3ae..8eabc713a26d 100644 --- a/drivers/staging/greybus/es2.c +++ b/drivers/staging/greybus/es2.c @@ -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,