diff options
author | Muhammad Falak R Wani <falakreyaz@gmail.com> | 2016-05-19 19:34:36 +0530 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2016-07-15 14:23:21 +0200 |
commit | d6c4dc3bf4e934fae7002f296aaef4b578f7ca14 (patch) | |
tree | bbd9f52d4c241faff29e296b12faf2fbf040b8d8 /drivers | |
parent | d8d841e8332779fae2b18420d39ef407ea3729da (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/cp210x.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 96a70789b4c2..4d6a5c672a3d 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -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, |