Skip to content

Commit

Permalink
USB: Realtek cr: 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.

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 15, 2011
1 parent ce3af89 commit eb54552
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/usb/storage/realtek_cr.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,9 @@ static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
u8 cmnd[12] = { 0 };
u8 *buf;

buf = kmalloc(len, GFP_NOIO);
buf = kmemdup(data, len, GFP_NOIO);
if (buf == NULL)
return USB_STOR_TRANSPORT_ERROR;
memcpy(buf, data, len);

US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len);

Expand Down

0 comments on commit eb54552

Please sign in to comment.