mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 10:01:25 +00:00
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>
This commit is contained in:
parent
a8a89b7f60
commit
a47cacbd86
1 changed files with 2 additions and 4 deletions
|
@ -80,17 +80,15 @@ struct scatterlist*
|
||||||
videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
|
videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
|
||||||
{
|
{
|
||||||
struct scatterlist *sglist;
|
struct scatterlist *sglist;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
if (NULL == pages[0])
|
if (NULL == pages[0])
|
||||||
return NULL;
|
return NULL;
|
||||||
sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL);
|
sglist = kmalloc(nr_pages * sizeof(*sglist), GFP_KERNEL);
|
||||||
if (NULL == sglist)
|
if (NULL == sglist)
|
||||||
return NULL;
|
return NULL;
|
||||||
sg_init_table(sglist, nr_pages);
|
sg_init_table(sglist, nr_pages);
|
||||||
|
|
||||||
if (NULL == pages[0])
|
|
||||||
goto nopage;
|
|
||||||
if (PageHighMem(pages[0]))
|
if (PageHighMem(pages[0]))
|
||||||
/* DMA to highmem pages might not work */
|
/* DMA to highmem pages might not work */
|
||||||
goto highmem;
|
goto highmem;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue