forked from luck/tmp_suning_uos_patched
USB: serial: cp210x: use kmemdup
Use kmemdup when some other buffer is immediately copied into allocated region. It replaces call to allocation followed by memcpy, by a single call to kmemdup. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
parent
d8d841e833
commit
d6c4dc3bf4
@ -496,12 +496,10 @@ static int cp210x_write_reg_block(struct usb_serial_port *port, u8 req,
|
||||
void *dmabuf;
|
||||
int result;
|
||||
|
||||
dmabuf = kmalloc(bufsize, GFP_KERNEL);
|
||||
dmabuf = kmemdup(buf, bufsize, GFP_KERNEL);
|
||||
if (!dmabuf)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(dmabuf, buf, bufsize);
|
||||
|
||||
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
|
||||
req, REQTYPE_HOST_TO_INTERFACE, 0,
|
||||
port_priv->bInterfaceNumber, dmabuf, bufsize,
|
||||
|
Loading…
Reference in New Issue
Block a user