Skip to content

Commit

Permalink
Staging: line6: Use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
 Use kmemdup rather than duplicating its implementation

 The semantic patch that makes this change is available
 in scripts/coccinelle/api/memdup.cocci.

 More information about semantic patching is available at
 http://coccinelle.lip6.fr/

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Thomas Meyer authored and Greg Kroah-Hartman committed Nov 27, 2011
1 parent 140e28b commit cff8638
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/line6/midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,14 @@ static int send_midi_async(struct usb_line6 *line6, unsigned char *data,
line6_write_hexdump(line6, 'S', data, length);
#endif

transfer_buffer = kmalloc(length, GFP_ATOMIC);
transfer_buffer = kmemdup(data, length, GFP_ATOMIC);

if (transfer_buffer == NULL) {
usb_free_urb(urb);
dev_err(line6->ifcdev, "Out of memory\n");
return -ENOMEM;
}

memcpy(transfer_buffer, data, length);
usb_fill_int_urb(urb, line6->usbdev,
usb_sndbulkpipe(line6->usbdev,
line6->ep_control_write),
Expand Down

0 comments on commit cff8638

Please sign in to comment.