net: usb: ch9200: 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: David S. Miller <davem@davemloft.net>
This commit is contained in:
Muhammad Falak R Wani 2016-05-19 19:26:50 +05:30 committed by David S. Miller
parent 5877debe27
commit 238a9584e9
1 changed files with 1 additions and 2 deletions

View File

@ -155,12 +155,11 @@ static int control_write(struct usbnet *dev, unsigned char request,
index, size);
if (data) {
buf = kmalloc(size, GFP_KERNEL);
buf = kmemdup(data, size, GFP_KERNEL);
if (!buf) {
err = -ENOMEM;
goto err_out;
}
memcpy(buf, data, size);
}
err = usb_control_msg(dev->udev,