staging: greybus: es2: Use kmemdup instead of kmalloc and memcpy
PATCH 1/1 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 <[email protected]>
--- drivers/staging/greybus/es2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/greybus/es2.c +1 -2
@@ -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,
Signature · 1 line
2.7.4
[+CC: staging list ]
Quoted 4 lines · sayli karnik
This patch replaces kmalloc and memcpy with kmemdup for duplication of memory.
Signed-off-by sayli karnik <[email protected]>
Acked-by Johan Hovold <[email protected]>
Quoted 10 lines
--- drivers/staging/greybus/es2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/staging/greybus/es2.c +0
-0@@ -175,10 +175,9 @@ static int output_sync(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd)u8 *data;
drivers/staging/greybus/es2.c static int output_sync(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd) · line 183
Quoted 10 lines
drivers/staging/greybus/es2.c +1
-2int 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,
Thanks,
Johan