V4L/DVB: drivers/media/video/tlg2300: Use kmemdup
authorJulia Lawall <julia@diku.dk>
Thu, 1 Jul 2010 04:41:44 +0000 (01:41 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 2 Aug 2010 18:03:36 +0000 (15:03 -0300)
commit2b3c543a839cafeb3edd7e1a2202d86318801fd9
tree78f645227ed11d0f0eab4bd14cee7a5f288e1f8a
parent1ece36097d0170a41fc129b8b1823a36ec2fb5c6
V4L/DVB: drivers/media/video/tlg2300: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/tlg2300/pd-main.c