mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] USB: Realtek cr: Use kmemdup rather than duplicating its implementation
@ 2011-11-10 18:27 Thomas Meyer
  0 siblings, 0 replies; only message in thread
From: Thomas Meyer @ 2011-11-10 18:27 UTC (permalink / raw)
  To: Matthew Dharm, Greg Kroah-Hartman, linux-kernel

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>
---

diff -u -p a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
--- a/drivers/usb/storage/realtek_cr.c 2011-11-07 19:38:15.850375635 +0100
+++ b/drivers/usb/storage/realtek_cr.c 2011-11-08 10:56:26.333926507 +0100
@@ -398,10 +398,9 @@ static int rts51x_write_mem(struct us_da
 	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);
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-10 18:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10 18:27 [PATCH] USB: Realtek cr: Use kmemdup rather than duplicating its implementation Thomas Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome