diff options
author | Panagiotis Issaris <takis@issaris.org> | 2006-01-11 16:40:56 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-11 16:40:56 -0500 |
commit | 7408187d223f63d46a13b6a35b8f96b032c2f623 (patch) | |
tree | 425a459f760295de488f57e3f97b034aaa76a78d /drivers/media/video/video-buf.c | |
parent | 0b3af1b6df82cfdb54ae294ed860263011fa0408 (diff) |
V4L/DVB (3344a): Conversions from kmalloc+memset to k(z|c)alloc
Conversions from kmalloc+memset to k(z|c)alloc.
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 'drivers/media/video/video-buf.c')
-rw-r--r-- | drivers/media/video/video-buf.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 9a6bf287e26a..9ef477523d27 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
@@ -52,10 +52,9 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) | |||
52 | struct page *pg; | 52 | struct page *pg; |
53 | int i; | 53 | int i; |
54 | 54 | ||
55 | sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); | 55 | sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); |
56 | if (NULL == sglist) | 56 | if (NULL == sglist) |
57 | return NULL; | 57 | return NULL; |
58 | memset(sglist,0,sizeof(struct scatterlist)*nr_pages); | ||
59 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { | 58 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { |
60 | pg = vmalloc_to_page(virt); | 59 | pg = vmalloc_to_page(virt); |
61 | if (NULL == pg) | 60 | if (NULL == pg) |
@@ -80,10 +79,9 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) | |||
80 | 79 | ||
81 | if (NULL == pages[0]) | 80 | if (NULL == pages[0]) |
82 | return NULL; | 81 | return NULL; |
83 | sglist = kmalloc(sizeof(*sglist) * nr_pages, GFP_KERNEL); | 82 | sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL); |
84 | if (NULL == sglist) | 83 | if (NULL == sglist) |
85 | return NULL; | 84 | return NULL; |
86 | memset(sglist, 0, sizeof(*sglist) * nr_pages); | ||
87 | 85 | ||
88 | if (NULL == pages[0]) | 86 | if (NULL == pages[0]) |
89 | goto nopage; | 87 | goto nopage; |
@@ -284,9 +282,8 @@ void* videobuf_alloc(unsigned int size) | |||
284 | { | 282 | { |
285 | struct videobuf_buffer *vb; | 283 | struct videobuf_buffer *vb; |
286 | 284 | ||
287 | vb = kmalloc(size,GFP_KERNEL); | 285 | vb = kzalloc(size,GFP_KERNEL); |
288 | if (NULL != vb) { | 286 | if (NULL != vb) { |
289 | memset(vb,0,size); | ||
290 | videobuf_dma_init(&vb->dma); | 287 | videobuf_dma_init(&vb->dma); |
291 | init_waitqueue_head(&vb->done); | 288 | init_waitqueue_head(&vb->done); |
292 | vb->magic = MAGIC_BUFFER; | 289 | vb->magic = MAGIC_BUFFER; |