summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/video-buf.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <devnull@localhost>2006-01-11 19:28:02 +0000
committerMauro Carvalho Chehab <devnull@localhost>2006-01-11 19:28:02 +0000
commit069637ed9609cb009c57d2bf1039e69812b2304b (patch)
tree043bf8adc38ec355490eff08f7bbdfe90a230456 /linux/drivers/media/video/video-buf.c
parent40aca7dd04e8f2d3e3a8cddd5d3d8c3d596c978f (diff)
downloadmediapointer-dvb-s2-069637ed9609cb009c57d2bf1039e69812b2304b.tar.gz
mediapointer-dvb-s2-069637ed9609cb009c57d2bf1039e69812b2304b.tar.bz2
From: Panagiotis Issaris <takis@issaris.org>
Conversions from kmalloc+memset to k(z|c)alloc Conversions from kmalloc+memset to k(z|c)alloc. kernel-sync Signed-off-by: Panagiotis Issaris <takis@issaris.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/video-buf.c')
-rw-r--r--linux/drivers/media/video/video-buf.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/linux/drivers/media/video/video-buf.c b/linux/drivers/media/video/video-buf.c
index 7f825dc4d..a2222b6b9 100644
--- a/linux/drivers/media/video/video-buf.c
+++ b/linux/drivers/media/video/video-buf.c
@@ -1,5 +1,5 @@
/*
- * $Id: video-buf.c,v 1.24 2005/12/08 12:35:58 mchehab Exp $
+ * $Id: video-buf.c,v 1.25 2006/01/11 19:28:02 mchehab Exp $
*
* generic helper functions for video4linux capture buffers, to handle
* memory management and PCI DMA. Right now bttv + saa7134 use it.
@@ -54,10 +54,9 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages)
struct page *pg;
int i;
- sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL);
+ sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
if (NULL == sglist)
return NULL;
- memset(sglist,0,sizeof(struct scatterlist)*nr_pages);
for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
pg = vmalloc_to_page(virt);
if (NULL == pg)
@@ -82,10 +81,9 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
if (NULL == pages[0])
return NULL;
- sglist = kmalloc(sizeof(*sglist) * nr_pages, GFP_KERNEL);
+ sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL);
if (NULL == sglist)
return NULL;
- memset(sglist, 0, sizeof(*sglist) * nr_pages);
if (NULL == pages[0])
goto nopage;
@@ -291,9 +289,8 @@ void* videobuf_alloc(unsigned int size)
{
struct videobuf_buffer *vb;
- vb = kmalloc(size,GFP_KERNEL);
+ vb = kzalloc(size,GFP_KERNEL);
if (NULL != vb) {
- memset(vb,0,size);
videobuf_dma_init(&vb->dma);
init_waitqueue_head(&vb->done);
vb->magic = MAGIC_BUFFER;