aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;