diff options
author | Muhammad Falak R Wani <falakreyaz@gmail.com> | 2016-05-19 15:56:50 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-21 01:50:07 +0200 |
commit | 238a9584e9e2c7b3ea23924e9183fee05d584789 (patch) | |
tree | a77c7a32e66c9c9961cb7ef8eab2995ab5a7cda3 /drivers/net | |
parent | ps3_gelic: use kmemdup (diff) | |
download | linux-238a9584e9e2c7b3ea23924e9183fee05d584789.tar.xz linux-238a9584e9e2c7b3ea23924e9183fee05d584789.zip |
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/ch9200.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/usb/ch9200.c b/drivers/net/usb/ch9200.c index 5e151e6a3e09..8a40202c0a17 100644 --- a/drivers/net/usb/ch9200.c +++ b/drivers/net/usb/ch9200.c @@ -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, |