aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorChristophe Jaillet <jaillet.christophe@wanadoo.fr>2008-07-04 05:33:22 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:19:10 -0400
commita47cacbd869b67ce16981ad5a0b06e4eac2efaff (patch)
tree936ba20bf1c5395e94ab95ce2cdd78801898a2fe /drivers/media/video
parenta8a89b7f60f18c2517c3b950f5ecede0626363eb (diff)
V4L/DVB (8252): buf-dma-sg.c: avoid clearing memory twice
1) Remove a useless initialisation of 'i' 2) Avoid clearing the memory allocated twice (once in 'kcalloc', once in 'sg_init_table') 3) Remove a test that can never trigger. The function returns NULL in such a case, so we know that at this point 'pages[0]' != NULL Signed-off-by: Christophe Jaillet <jaillet.christophe@wanadoo.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/videobuf-dma-sg.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index 03a7b946bd54..8ed60827d350 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -80,17 +80,15 @@ struct scatterlist*
80videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) 80videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
81{ 81{
82 struct scatterlist *sglist; 82 struct scatterlist *sglist;
83 int i = 0; 83 int i;
84 84
85 if (NULL == pages[0]) 85 if (NULL == pages[0])
86 return NULL; 86 return NULL;
87 sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL); 87 sglist = kmalloc(nr_pages * sizeof(*sglist), GFP_KERNEL);
88 if (NULL == sglist) 88 if (NULL == sglist)
89 return NULL; 89 return NULL;
90 sg_init_table(sglist, nr_pages); 90 sg_init_table(sglist, nr_pages);
91 91
92 if (NULL == pages[0])
93 goto nopage;
94 if (PageHighMem(pages[0])) 92 if (PageHighMem(pages[0]))
95 /* DMA to highmem pages might not work */ 93 /* DMA to highmem pages might not work */
96 goto highmem; 94 goto highmem;