aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/saa7146_core.c9
-rw-r--r--drivers/media/common/saa7146_fops.c6
2 files changed, 5 insertions, 10 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 2899d34e5f7e..04c1938b9c91 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -109,10 +109,9 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
109 struct page *pg; 109 struct page *pg;
110 int i; 110 int i;
111 111
112 sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); 112 sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
113 if (NULL == sglist) 113 if (NULL == sglist)
114 return NULL; 114 return NULL;
115 memset(sglist,0,sizeof(struct scatterlist)*nr_pages);
116 for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { 115 for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
117 pg = vmalloc_to_page(virt); 116 pg = vmalloc_to_page(virt);
118 if (NULL == pg) 117 if (NULL == pg)
@@ -306,15 +305,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
306 struct saa7146_dev *dev; 305 struct saa7146_dev *dev;
307 int err = -ENOMEM; 306 int err = -ENOMEM;
308 307
309 dev = kmalloc(sizeof(struct saa7146_dev), GFP_KERNEL); 308 /* clear out mem for sure */
309 dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL);
310 if (!dev) { 310 if (!dev) {
311 ERR(("out of memory.\n")); 311 ERR(("out of memory.\n"));
312 goto out; 312 goto out;
313 } 313 }
314 314
315 /* clear out mem for sure */
316 memset(dev, 0x0, sizeof(struct saa7146_dev));
317
318 DEB_EE(("pci:%p\n",pci)); 315 DEB_EE(("pci:%p\n",pci));
319 316
320 err = pci_enable_device(pci); 317 err = pci_enable_device(pci);
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index b614612be7b4..f8cf73ed49ad 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -239,13 +239,12 @@ static int fops_open(struct inode *inode, struct file *file)
239 } 239 }
240 240
241 /* allocate per open data */ 241 /* allocate per open data */
242 fh = kmalloc(sizeof(*fh),GFP_KERNEL); 242 fh = kzalloc(sizeof(*fh),GFP_KERNEL);
243 if (NULL == fh) { 243 if (NULL == fh) {
244 DEB_S(("cannot allocate memory for per open data.\n")); 244 DEB_S(("cannot allocate memory for per open data.\n"));
245 result = -ENOMEM; 245 result = -ENOMEM;
246 goto out; 246 goto out;
247 } 247 }
248 memset(fh,0,sizeof(*fh));
249 248
250 file->private_data = fh; 249 file->private_data = fh;
251 fh->dev = dev; 250 fh->dev = dev;
@@ -464,12 +463,11 @@ static struct video_device device_template =
464 463
465int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) 464int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
466{ 465{
467 struct saa7146_vv *vv = kmalloc (sizeof(struct saa7146_vv),GFP_KERNEL); 466 struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL);
468 if( NULL == vv ) { 467 if( NULL == vv ) {
469 ERR(("out of memory. aborting.\n")); 468 ERR(("out of memory. aborting.\n"));
470 return -1; 469 return -1;
471 } 470 }
472 memset(vv, 0x0, sizeof(*vv));
473 471
474 DEB_EE(("dev:%p\n",dev)); 472 DEB_EE(("dev:%p\n",dev));
475 473