[PATCH] kmemdup: some users
[firefly-linux-kernel-4.4.55.git] / sound / usb / usbmidi.c
index abe29dadd979365e01d1458ac00531dd292d1984..0dcf78adb99a879365b5949e9c9092076d120508 100644 (file)
@@ -323,10 +323,9 @@ static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep,
                                 const void *data, int len)
 {
        int err;
-       void *buf = kmalloc(len, GFP_KERNEL);
+       void *buf = kmemdup(data, len, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
-       memcpy(buf, data, len);
        dump_urb("sending", buf, len);
        err = usb_bulk_msg(ep->umidi->chip->dev, ep->urb->pipe, buf, len,
                           NULL, 250);