Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 238a9584 authored by Muhammad Falak R Wani's avatar Muhammad Falak R Wani Committed by David S. Miller
Browse files

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: default avatarMuhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5877debe
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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,