mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: go7007: Use kmemdup rather than duplicating its implementation
@ 2011-11-12 17:02 Thomas Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Meyer @ 2011-11-12 17:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, open list

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/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c
--- a/drivers/staging/media/go7007/go7007-driver.c 2011-11-07 19:38:11.440308651 +0100
+++ b/drivers/staging/media/go7007/go7007-driver.c 2011-11-08 10:52:05.237093171 +0100
@@ -109,14 +109,13 @@ static int go7007_load_encoder(struct go
 		return -1;
 	}
 	fw_len = fw_entry->size - 16;
-	bounce = kmalloc(fw_len, GFP_KERNEL);
+	bounce = kmemdup(fw_entry->data + 16, fw_len, GFP_KERNEL);
 	if (bounce == NULL) {
 		v4l2_err(go, "unable to allocate %d bytes for "
 				"firmware transfer\n", fw_len);
 		release_firmware(fw_entry);
 		return -1;
 	}
-	memcpy(bounce, fw_entry->data + 16, fw_len);
 	release_firmware(fw_entry);
 	if (go7007_interface_reset(go) < 0 ||
 			go7007_send_firmware(go, bounce, fw_len) < 0 ||




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] staging: go7007: Use kmemdup rather than duplicating its implementation
@ 2011-11-12 12:18 Thomas Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Meyer @ 2011-11-12 12:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, 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/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c
--- a/drivers/staging/media/go7007/go7007-driver.c 2011-11-07 19:38:11.440308651 +0100
+++ b/drivers/staging/media/go7007/go7007-driver.c 2011-11-08 10:52:05.237093171 +0100
@@ -109,14 +109,13 @@ static int go7007_load_encoder(struct go
 		return -1;
 	}
 	fw_len = fw_entry->size - 16;
-	bounce = kmalloc(fw_len, GFP_KERNEL);
+	bounce = kmemdup(fw_entry->data + 16, fw_len, GFP_KERNEL);
 	if (bounce == NULL) {
 		v4l2_err(go, "unable to allocate %d bytes for "
 				"firmware transfer\n", fw_len);
 		release_firmware(fw_entry);
 		return -1;
 	}
-	memcpy(bounce, fw_entry->data + 16, fw_len);
 	release_firmware(fw_entry);
 	if (go7007_interface_reset(go) < 0 ||
 			go7007_send_firmware(go, bounce, fw_len) < 0 ||



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-12 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-12 17:02 [PATCH] staging: go7007: Use kmemdup rather than duplicating its implementation Thomas Meyer
  -- strict thread matches above, loose matches on Subject: below --
2011-11-12 12:18 Thomas Meyer

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

all inboxes | Powered by JetHome®