media: use pci_zalloc_consistent
authorJoe Perches <joe@perches.com>
Fri, 8 Aug 2014 21:24:21 +0000 (14:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Aug 2014 22:57:28 +0000 (15:57 -0700)
Remove the now unnecessary memset too.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/media/common/saa7146/saa7146_core.c
drivers/media/common/saa7146/saa7146_fops.c
drivers/media/pci/bt8xx/bt878.c
drivers/media/pci/ngene/ngene-core.c
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
drivers/media/usb/ttusb-dec/ttusb_dec.c

index 34b0d0ddeef3f4003928487420e22aac5fb39d73..97afee672d07e228a350d63c88b148234e5032cb 100644 (file)
@@ -421,23 +421,20 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
        err = -ENOMEM;
 
        /* get memory for various stuff */
-       dev->d_rps0.cpu_addr = pci_alloc_consistent(pci, SAA7146_RPS_MEM,
-                                                   &dev->d_rps0.dma_handle);
+       dev->d_rps0.cpu_addr = pci_zalloc_consistent(pci, SAA7146_RPS_MEM,
+                                                    &dev->d_rps0.dma_handle);
        if (!dev->d_rps0.cpu_addr)
                goto err_free_irq;
-       memset(dev->d_rps0.cpu_addr, 0x0, SAA7146_RPS_MEM);
 
-       dev->d_rps1.cpu_addr = pci_alloc_consistent(pci, SAA7146_RPS_MEM,
-                                                   &dev->d_rps1.dma_handle);
+       dev->d_rps1.cpu_addr = pci_zalloc_consistent(pci, SAA7146_RPS_MEM,
+                                                    &dev->d_rps1.dma_handle);
        if (!dev->d_rps1.cpu_addr)
                goto err_free_rps0;
-       memset(dev->d_rps1.cpu_addr, 0x0, SAA7146_RPS_MEM);
 
-       dev->d_i2c.cpu_addr = pci_alloc_consistent(pci, SAA7146_RPS_MEM,
-                                                  &dev->d_i2c.dma_handle);
+       dev->d_i2c.cpu_addr = pci_zalloc_consistent(pci, SAA7146_RPS_MEM,
+                                                   &dev->d_i2c.dma_handle);
        if (!dev->d_i2c.cpu_addr)
                goto err_free_rps1;
-       memset(dev->d_i2c.cpu_addr, 0x0, SAA7146_RPS_MEM);
 
        /* the rest + print status message */
 
index d9e1d6395ed9499f2df0e681bfa04b46b3d1adfe..6c47f3fe9b0fc2ba2f8eb9263a2f0e9d0396d870 100644 (file)
@@ -520,14 +520,15 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
           configuration data) */
        dev->ext_vv_data = ext_vv;
 
-       vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle);
+       vv->d_clipping.cpu_addr =
+               pci_zalloc_consistent(dev->pci, SAA7146_CLIPPING_MEM,
+                                     &vv->d_clipping.dma_handle);
        if( NULL == vv->d_clipping.cpu_addr ) {
                ERR("out of memory. aborting.\n");
                kfree(vv);
                v4l2_ctrl_handler_free(hdl);
                return -1;
        }
-       memset(vv->d_clipping.cpu_addr, 0x0, SAA7146_CLIPPING_MEM);
 
        saa7146_video_uops.init(dev,vv);
        if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
index d0c281f41a0aa98f368ec37fed1748e31284cb62..11765835d7b2977ec3317863f05f2560b25eff1c 100644 (file)
@@ -101,28 +101,20 @@ static int bt878_mem_alloc(struct bt878 *bt)
        if (!bt->buf_cpu) {
                bt->buf_size = 128 * 1024;
 
-               bt->buf_cpu =
-                   pci_alloc_consistent(bt->dev, bt->buf_size,
-                                        &bt->buf_dma);
-
+               bt->buf_cpu = pci_zalloc_consistent(bt->dev, bt->buf_size,
+                                                   &bt->buf_dma);
                if (!bt->buf_cpu)
                        return -ENOMEM;
-
-               memset(bt->buf_cpu, 0, bt->buf_size);
        }
 
        if (!bt->risc_cpu) {
                bt->risc_size = PAGE_SIZE;
-               bt->risc_cpu =
-                   pci_alloc_consistent(bt->dev, bt->risc_size,
-                                        &bt->risc_dma);
-
+               bt->risc_cpu = pci_zalloc_consistent(bt->dev, bt->risc_size,
+                                                    &bt->risc_dma);
                if (!bt->risc_cpu) {
                        bt878_mem_free(bt);
                        return -ENOMEM;
                }
-
-               memset(bt->risc_cpu, 0, bt->risc_size);
        }
 
        return 0;
index 826228c3800ec3747e7a3cb11537f26751bea073..4930b55fd5f4f855399ebb6c828daece0c579ce8 100644 (file)
@@ -1075,12 +1075,11 @@ static int AllocCommonBuffers(struct ngene *dev)
        dev->ngenetohost = dev->FWInterfaceBuffer + 256;
        dev->EventBuffer = dev->FWInterfaceBuffer + 512;
 
-       dev->OverflowBuffer = pci_alloc_consistent(dev->pci_dev,
-                                                  OVERFLOW_BUFFER_SIZE,
-                                                  &dev->PAOverflowBuffer);
+       dev->OverflowBuffer = pci_zalloc_consistent(dev->pci_dev,
+                                                   OVERFLOW_BUFFER_SIZE,
+                                                   &dev->PAOverflowBuffer);
        if (!dev->OverflowBuffer)
                return -ENOMEM;
-       memset(dev->OverflowBuffer, 0, OVERFLOW_BUFFER_SIZE);
 
        for (i = STREAM_VIDEOIN1; i < MAX_STREAM; i++) {
                int type = dev->card_info->io_type[i];
index f166ffc9800a3b069c8792c387d7e840608d4720..cef7a00099ea8cfe6ec6501fe0a18ecb03280c52 100644 (file)
@@ -803,11 +803,9 @@ static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
 {
        int i;
 
-       ttusb->iso_buffer = pci_alloc_consistent(NULL,
-                                                ISO_FRAME_SIZE *
-                                                FRAMES_PER_ISO_BUF *
-                                                ISO_BUF_COUNT,
-                                                &ttusb->iso_dma_handle);
+       ttusb->iso_buffer = pci_zalloc_consistent(NULL,
+                                                 ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * ISO_BUF_COUNT,
+                                                 &ttusb->iso_dma_handle);
 
        if (!ttusb->iso_buffer) {
                dprintk("%s: pci_alloc_consistent - not enough memory\n",
@@ -815,9 +813,6 @@ static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
                return -ENOMEM;
        }
 
-       memset(ttusb->iso_buffer, 0,
-              ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * ISO_BUF_COUNT);
-
        for (i = 0; i < ISO_BUF_COUNT; i++) {
                struct urb *urb;
 
index 29724af9b9ab11fbb36c1871bacada0fde62409c..15ab584cf265615518489a091e4ab243095e7c22 100644 (file)
@@ -1151,11 +1151,9 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec)
 
        dprintk("%s\n", __func__);
 
-       dec->iso_buffer = pci_alloc_consistent(NULL,
-                                              ISO_FRAME_SIZE *
-                                              (FRAMES_PER_ISO_BUF *
-                                               ISO_BUF_COUNT),
-                                              &dec->iso_dma_handle);
+       dec->iso_buffer = pci_zalloc_consistent(NULL,
+                                               ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT),
+                                               &dec->iso_dma_handle);
 
        if (!dec->iso_buffer) {
                dprintk("%s: pci_alloc_consistent - not enough memory\n",
@@ -1163,9 +1161,6 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec)
                return -ENOMEM;
        }
 
-       memset(dec->iso_buffer, 0,
-              ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT));
-
        for (i = 0; i < ISO_BUF_COUNT; i++) {
                struct urb *urb;