aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-10 13:27:42 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-15 13:21:55 -0500
commiteb545522944d9dcff66ff45d321bb6e6d44d0075 (patch)
tree9befa976e0e31ba465dd58543b6e2aa067d1aac9 /drivers/usb/storage
parentce3af89e761b413bef72b49f650fa0ae55f3b6d5 (diff)
USB: Realtek cr: Use kmemdup rather than duplicating its implementation
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>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/realtek_cr.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 30f64bfe101e..71147679cb11 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -398,10 +398,9 @@ static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
398 u8 cmnd[12] = { 0 }; 398 u8 cmnd[12] = { 0 };
399 u8 *buf; 399 u8 *buf;
400 400
401 buf = kmalloc(len, GFP_NOIO); 401 buf = kmemdup(data, len, GFP_NOIO);
402 if (buf == NULL) 402 if (buf == NULL)
403 return USB_STOR_TRANSPORT_ERROR; 403 return USB_STOR_TRANSPORT_ERROR;
404 memcpy(buf, data, len);
405 404
406 US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len); 405 US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len);
407 406