Commit 101b25b5 authored by Joe Perches's avatar Joe Perches Committed by Mauro Carvalho Chehab

[media] drivers/media: Use vzalloc

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 42e142f6
...@@ -1536,12 +1536,11 @@ int __devinit ngene_probe(struct pci_dev *pci_dev, ...@@ -1536,12 +1536,11 @@ int __devinit ngene_probe(struct pci_dev *pci_dev,
if (pci_enable_device(pci_dev) < 0) if (pci_enable_device(pci_dev) < 0)
return -ENODEV; return -ENODEV;
dev = vmalloc(sizeof(struct ngene)); dev = vzalloc(sizeof(struct ngene));
if (dev == NULL) { if (dev == NULL) {
stat = -ENOMEM; stat = -ENOMEM;
goto fail0; goto fail0;
} }
memset(dev, 0, sizeof(struct ngene));
dev->pci_dev = pci_dev; dev->pci_dev = pci_dev;
dev->card_info = (struct ngene_info *)id->driver_data; dev->card_info = (struct ngene_info *)id->driver_data;
......
...@@ -1186,13 +1186,12 @@ static int __devinit mx3_camera_probe(struct platform_device *pdev) ...@@ -1186,13 +1186,12 @@ static int __devinit mx3_camera_probe(struct platform_device *pdev)
goto egetres; goto egetres;
} }
mx3_cam = vmalloc(sizeof(*mx3_cam)); mx3_cam = vzalloc(sizeof(*mx3_cam));
if (!mx3_cam) { if (!mx3_cam) {
dev_err(&pdev->dev, "Could not allocate mx3 camera object\n"); dev_err(&pdev->dev, "Could not allocate mx3 camera object\n");
err = -ENOMEM; err = -ENOMEM;
goto ealloc; goto ealloc;
} }
memset(mx3_cam, 0, sizeof(*mx3_cam));
mx3_cam->clk = clk_get(&pdev->dev, NULL); mx3_cam->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(mx3_cam->clk)) { if (IS_ERR(mx3_cam->clk)) {
......
...@@ -287,14 +287,13 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) ...@@ -287,14 +287,13 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
/* create frame buffers, and make circular ring */ /* create frame buffers, and make circular ring */
for (i = 0; i < default_fbufs; i++) { for (i = 0; i < default_fbufs; i++) {
if (pdev->fbuf[i].data == NULL) { if (pdev->fbuf[i].data == NULL) {
kbuf = vmalloc(PWC_FRAME_SIZE); /* need vmalloc since frame buffer > 128K */ kbuf = vzalloc(PWC_FRAME_SIZE); /* need vmalloc since frame buffer > 128K */
if (kbuf == NULL) { if (kbuf == NULL) {
PWC_ERROR("Failed to allocate frame buffer %d.\n", i); PWC_ERROR("Failed to allocate frame buffer %d.\n", i);
return -ENOMEM; return -ENOMEM;
} }
PWC_DEBUG_MEMORY("Allocated frame buffer %d at %p.\n", i, kbuf); PWC_DEBUG_MEMORY("Allocated frame buffer %d at %p.\n", i, kbuf);
pdev->fbuf[i].data = kbuf; pdev->fbuf[i].data = kbuf;
memset(kbuf, 0, PWC_FRAME_SIZE);
} }
} }
......
...@@ -69,10 +69,9 @@ static struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, ...@@ -69,10 +69,9 @@ static struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt,
struct page *pg; struct page *pg;
int i; int i;
sglist = vmalloc(nr_pages * sizeof(*sglist)); sglist = vzalloc(nr_pages * sizeof(*sglist));
if (NULL == sglist) if (NULL == sglist)
return NULL; return NULL;
memset(sglist, 0, nr_pages * sizeof(*sglist));
sg_init_table(sglist, nr_pages); sg_init_table(sglist, nr_pages);
for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
pg = vmalloc_to_page(virt); pg = vmalloc_to_page(virt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment