diff options
Diffstat (limited to 'linux/drivers/media')
48 files changed, 81 insertions, 160 deletions
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c index c6889d003..86d5acab3 100644 --- a/linux/drivers/media/common/saa7146_core.c +++ b/linux/drivers/media/common/saa7146_core.c @@ -109,10 +109,9 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) struct page *pg; int i; - sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); + sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); if (NULL == sglist) return NULL; - memset(sglist,0,sizeof(struct scatterlist)*nr_pages); for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { pg = vmalloc_to_page(virt); if (NULL == pg) @@ -306,15 +305,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent struct saa7146_dev *dev; int err = -ENOMEM; - dev = kmalloc(sizeof(struct saa7146_dev), GFP_KERNEL); + /* clear out mem for sure */ + dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL); if (!dev) { ERR(("out of memory.\n")); goto out; } - /* clear out mem for sure */ - memset(dev, 0x0, sizeof(struct saa7146_dev)); - DEB_EE(("pci:%p\n",pci)); err = pci_enable_device(pci); diff --git a/linux/drivers/media/common/saa7146_fops.c b/linux/drivers/media/common/saa7146_fops.c index 554618d3e..3396e399a 100644 --- a/linux/drivers/media/common/saa7146_fops.c +++ b/linux/drivers/media/common/saa7146_fops.c @@ -240,13 +240,12 @@ static int fops_open(struct inode *inode, struct file *file) } /* allocate per open data */ - fh = kmalloc(sizeof(*fh),GFP_KERNEL); + fh = kzalloc(sizeof(*fh),GFP_KERNEL); if (NULL == fh) { DEB_S(("cannot allocate memory for per open data.\n")); result = -ENOMEM; goto out; } - memset(fh,0,sizeof(*fh)); file->private_data = fh; fh->dev = dev; @@ -465,12 +464,11 @@ static struct video_device device_template = int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) { - struct saa7146_vv *vv = kmalloc (sizeof(struct saa7146_vv),GFP_KERNEL); + struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL); if( NULL == vv ) { ERR(("out of memory. aborting.\n")); return -1; } - memset(vv, 0x0, sizeof(*vv)); DEB_EE(("dev:%p\n",dev)); diff --git a/linux/drivers/media/dvb/b2c2/flexcop.c b/linux/drivers/media/dvb/b2c2/flexcop.c index 123ed96f6..56ba52470 100644 --- a/linux/drivers/media/dvb/b2c2/flexcop.c +++ b/linux/drivers/media/dvb/b2c2/flexcop.c @@ -220,20 +220,18 @@ EXPORT_SYMBOL(flexcop_reset_block_300); struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) { void *bus; - struct flexcop_device *fc = kmalloc(sizeof(struct flexcop_device), GFP_KERNEL); + struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), GFP_KERNEL); if (!fc) { err("no memory"); return NULL; } - memset(fc, 0, sizeof(struct flexcop_device)); - bus = kmalloc(bus_specific_len, GFP_KERNEL); + bus = kzalloc(bus_specific_len, GFP_KERNEL); if (!bus) { err("no memory"); kfree(fc); return NULL; } - memset(bus, 0, bus_specific_len); fc->bus_specific = bus; diff --git a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 5190ecb20..ad1ef4ca0 100644 --- a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -787,10 +787,9 @@ static int dvb_bt8xx_probe(struct device *dev) struct pci_dev* bttv_pci_dev; int ret; - if (!(card = kmalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) + if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) return -ENOMEM; - memset(card, 0, sizeof(*card)); init_MUTEX(&card->lock); card->bttv_nr = sub->core->nr; strncpy(card->card_name, sub->core->name, sizeof(sub->core->name)); diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 4bb779aef..00347a750 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -1649,21 +1649,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, return -EINVAL; /* initialise the system data */ - if ((ca = - (struct dvb_ca_private *) kmalloc(sizeof(struct dvb_ca_private), - GFP_KERNEL)) == NULL) { + if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) { ret = -ENOMEM; goto error; } - memset(ca, 0, sizeof(struct dvb_ca_private)); ca->pub = pubca; ca->flags = flags; ca->slot_count = slot_count; - if ((ca->slot_info = kmalloc(sizeof(struct dvb_ca_slot) * slot_count, GFP_KERNEL)) == NULL) { + if ((ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), GFP_KERNEL)) == NULL) { ret = -ENOMEM; goto error; } - memset(ca->slot_info, 0, sizeof(struct dvb_ca_slot) * slot_count); init_waitqueue_head(&ca->wait_queue); ca->thread_pid = 0; init_waitqueue_head(&ca->thread_queue); diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index 6158b9c95..bc5949acf 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -1030,13 +1030,12 @@ int dvb_register_frontend(struct dvb_adapter* dvb, if (down_interruptible (&frontend_mutex)) return -ERESTARTSYS; - fe->frontend_priv = kmalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); + fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); if (fe->frontend_priv == NULL) { up(&frontend_mutex); return -ENOMEM; } fepriv = fe->frontend_priv; - memset(fe->frontend_priv, 0, sizeof(struct dvb_frontend_private)); init_MUTEX (&fepriv->sem); init_waitqueue_head (&fepriv->wait_queue); diff --git a/linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c b/linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c index 0a94ec22a..cd21ddbfd 100644 --- a/linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c +++ b/linux/drivers/media/dvb/dvb-usb/dtt200u-fe.c @@ -156,10 +156,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) struct dtt200u_fe_state* state = NULL; /* allocate memory for the internal state */ - state = (struct dtt200u_fe_state*) kmalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); + state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct dtt200u_fe_state)); deb_info("attaching frontend dtt200u\n"); diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 2e23060cb..716f8bf52 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-init.c @@ -154,12 +154,11 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties } info("found a '%s' in warm state.",desc->name); - d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); + d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); if (d == NULL) { err("no memory for 'struct dvb_usb_device'"); return ret; } - memset(d,0,sizeof(struct dvb_usb_device)); d->udev = udev; memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); @@ -167,13 +166,12 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties d->owner = owner; if (d->props.size_of_priv > 0) { - d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); + d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL); if (d->priv == NULL) { err("no memory for priv in 'struct dvb_usb_device'"); kfree(d); return -ENOMEM; } - memset(d->priv,0,d->props.size_of_priv); } usb_set_intfdata(intf, d); diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index 36b7048c0..ee821974d 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c @@ -175,15 +175,13 @@ static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, un deb_mem("all in all I will use %lu bytes for streaming\n",num*size); - if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL) + if ((d->buf_list = kcalloc(num, sizeof(u8 *), GFP_ATOMIC)) == NULL) return -ENOMEM; - if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { + if ((d->dma_addr = kcalloc(num, sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { kfree(d->buf_list); return -ENOMEM; } - memset(d->buf_list,0,num*sizeof(u8 *)); - memset(d->dma_addr,0,num*sizeof(dma_addr_t)); d->state |= DVB_USB_STATE_URB_BUF; @@ -285,10 +283,9 @@ int dvb_usb_urb_init(struct dvb_usb_device *d) usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint)); /* allocate the array for the data transfer URBs */ - d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); + d->urb_list = kzalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); if (d->urb_list == NULL) return -ENOMEM; - memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *)); d->state |= DVB_USB_STATE_URB_LIST; switch (d->props.urb.type) { diff --git a/linux/drivers/media/dvb/dvb-usb/vp702x-fe.c b/linux/drivers/media/dvb/dvb-usb/vp702x-fe.c index 0885d9fb2..b6d95e1c9 100644 --- a/linux/drivers/media/dvb/dvb-usb/vp702x-fe.c +++ b/linux/drivers/media/dvb/dvb-usb/vp702x-fe.c @@ -281,10 +281,9 @@ static struct dvb_frontend_ops vp702x_fe_ops; struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) { - struct vp702x_fe_state *s = kmalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); + struct vp702x_fe_state *s = kzalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); if (s == NULL) goto error; - memset(s,0,sizeof(struct vp702x_fe_state)); s->d = d; s->fe.ops = &vp702x_fe_ops; diff --git a/linux/drivers/media/dvb/dvb-usb/vp7045-fe.c b/linux/drivers/media/dvb/dvb-usb/vp7045-fe.c index 83f1de1e7..5242cca5d 100644 --- a/linux/drivers/media/dvb/dvb-usb/vp7045-fe.c +++ b/linux/drivers/media/dvb/dvb-usb/vp7045-fe.c @@ -145,10 +145,9 @@ static struct dvb_frontend_ops vp7045_fe_ops; struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) { - struct vp7045_fe_state *s = kmalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); + struct vp7045_fe_state *s = kzalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); if (s == NULL) goto error; - memset(s,0,sizeof(struct vp7045_fe_state)); s->d = d; s->fe.ops = &vp7045_fe_ops; diff --git a/linux/drivers/media/dvb/frontends/bcm3510.c b/linux/drivers/media/dvb/frontends/bcm3510.c index 925e4575f..e50d598a8 100644 --- a/linux/drivers/media/dvb/frontends/bcm3510.c +++ b/linux/drivers/media/dvb/frontends/bcm3510.c @@ -782,10 +782,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, bcm3510_register_value v; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct bcm3510_state), GFP_KERNEL); + state = kzalloc(sizeof(struct bcm3510_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct bcm3510_state)); /* setup the state */ diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.c b/linux/drivers/media/dvb/frontends/dib3000mb.c index 6b0553608..ae589adb1 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mb.c +++ b/linux/drivers/media/dvb/frontends/dib3000mb.c @@ -700,10 +700,9 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, struct dib3000_state* state = NULL; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); + state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct dib3000_state)); /* setup the state */ state->i2c = i2c; diff --git a/linux/drivers/media/dvb/frontends/dib3000mc.c b/linux/drivers/media/dvb/frontends/dib3000mc.c index c024fad17..3b303dbb6 100644 --- a/linux/drivers/media/dvb/frontends/dib3000mc.c +++ b/linux/drivers/media/dvb/frontends/dib3000mc.c @@ -832,10 +832,9 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, u16 devid; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); + state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct dib3000_state)); /* setup the state */ state->i2c = i2c; diff --git a/linux/drivers/media/dvb/frontends/lgdt330x.c b/linux/drivers/media/dvb/frontends/lgdt330x.c index 311bb1f32..ed2acee48 100644 --- a/linux/drivers/media/dvb/frontends/lgdt330x.c +++ b/linux/drivers/media/dvb/frontends/lgdt330x.c @@ -730,10 +730,9 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, u8 buf[1]; /* Allocate memory for the internal state */ - state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); + state = kzalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(*state)); /* Setup the state */ state->config = config; diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c index f0c610f2c..aaaec909d 100644 --- a/linux/drivers/media/dvb/frontends/mt352.c +++ b/linux/drivers/media/dvb/frontends/mt352.c @@ -535,9 +535,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, struct mt352_state* state = NULL; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct mt352_state), GFP_KERNEL); + state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(*state)); /* setup the state */ state->i2c = i2c; diff --git a/linux/drivers/media/dvb/frontends/nxt200x.c b/linux/drivers/media/dvb/frontends/nxt200x.c index aeafef46e..78d2b93d3 100644 --- a/linux/drivers/media/dvb/frontends/nxt200x.c +++ b/linux/drivers/media/dvb/frontends/nxt200x.c @@ -1110,10 +1110,9 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, u8 buf [] = {0,0,0,0,0}; /* allocate memory for the internal state */ - state = (struct nxt200x_state*) kmalloc(sizeof(struct nxt200x_state), GFP_KERNEL); + state = kzalloc(sizeof(struct nxt200x_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(*state)); /* setup the state */ state->config = config; diff --git a/linux/drivers/media/dvb/pluto2/pluto2.c b/linux/drivers/media/dvb/pluto2/pluto2.c index bbebd1c4c..1c5316e20 100644 --- a/linux/drivers/media/dvb/pluto2/pluto2.c +++ b/linux/drivers/media/dvb/pluto2/pluto2.c @@ -584,11 +584,10 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, struct dmx_demux *dmx; int ret = -ENOMEM; - pluto = kmalloc(sizeof(struct pluto), GFP_KERNEL); + pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL); if (!pluto) goto out; - memset(pluto, 0, sizeof(struct pluto)); pluto->pdev = pdev; ret = pci_enable_device(pdev); diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index 0f09c5181..ecb2f33ce 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -2565,14 +2565,12 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d } /* prepare the av7110 device struct */ - av7110 = kmalloc(sizeof(struct av7110), GFP_KERNEL); + av7110 = kzalloc(sizeof(struct av7110), GFP_KERNEL); if (!av7110) { dprintk(1, "out of memory\n"); return -ENOMEM; } - memset(av7110, 0, sizeof(struct av7110)); - av7110->card_name = (char*) pci_ext->ext_priv; av7110->dev = dev; dev->ext_priv = av7110; diff --git a/linux/drivers/media/dvb/ttpci/budget-av.c b/linux/drivers/media/dvb/ttpci/budget-av.c index f9d00452e..aa2645895 100644 --- a/linux/drivers/media/dvb/ttpci/budget-av.c +++ b/linux/drivers/media/dvb/ttpci/budget-av.c @@ -1027,11 +1027,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio dprintk(2, "dev: %p\n", dev); - if (!(budget_av = kmalloc(sizeof(struct budget_av), GFP_KERNEL))) + if (!(budget_av = kzalloc(sizeof(struct budget_av), GFP_KERNEL))) return -ENOMEM; - memset(budget_av, 0, sizeof(struct budget_av)); - budget_av->has_saa7113 = 0; budget_av->budget.ci_present = 0; diff --git a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 0e813a4cf..589e6e0e7 100644 --- a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -1489,11 +1489,9 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV; - if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL))) + if (!(ttusb = kzalloc(sizeof(struct ttusb), GFP_KERNEL))) return -ENOMEM; - memset(ttusb, 0, sizeof(struct ttusb)); - ttusb->dev = udev; ttusb->c = 0; ttusb->mux_state = 0; diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index d8966d1d2..df831171e 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1606,15 +1606,13 @@ static int ttusb_dec_probe(struct usb_interface *intf, udev = interface_to_usbdev(intf); - if (!(dec = kmalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { + if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { printk("%s: couldn't allocate memory.\n", __FUNCTION__); return -ENOMEM; } usb_set_intfdata(intf, (void *)dec); - memset(dec, 0, sizeof(struct ttusb_dec)); - switch (le16_to_cpu(id->idProduct)) { case 0x1006: ttusb_dec_set_model(dec, TTUSB_DEC3000S); diff --git a/linux/drivers/media/video/bt832.c b/linux/drivers/media/video/bt832.c index c4a56a619..0a8fffbe2 100644 --- a/linux/drivers/media/video/bt832.c +++ b/linux/drivers/media/video/bt832.c @@ -192,9 +192,8 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, client_template.adapter = adap; client_template.addr = addr; - if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) + if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL))) return -ENOMEM; - memset(t,0,sizeof(*t)); t->client = client_template; i2c_set_clientdata(&t->client, t); i2c_attach_client(&t->client); diff --git a/linux/drivers/media/video/bttv-gpio.c b/linux/drivers/media/video/bttv-gpio.c index c17feb954..f2ec2e787 100644 --- a/linux/drivers/media/video/bttv-gpio.c +++ b/linux/drivers/media/video/bttv-gpio.c @@ -1,5 +1,5 @@ /* - $Id: bttv-gpio.c,v 1.10 2005/12/10 17:51:31 rmcc Exp $ + $Id: bttv-gpio.c,v 1.11 2006/01/11 19:28:02 mchehab Exp $ bttv-gpio.c -- gpio sub drivers @@ -65,10 +65,9 @@ int bttv_sub_add_device(struct bttv_core *core, char *name) struct bttv_sub_device *sub; int err; - sub = kmalloc(sizeof(*sub),GFP_KERNEL); + sub = kzalloc(sizeof(*sub),GFP_KERNEL); if (NULL == sub) return -ENOMEM; - memset(sub,0,sizeof(*sub)); sub->core = core; sub->dev.parent = &core->pci->dev; diff --git a/linux/drivers/media/video/cs53l32a.c b/linux/drivers/media/video/cs53l32a.c index 8ecd1b98f..809b4f2b4 100644 --- a/linux/drivers/media/video/cs53l32a.c +++ b/linux/drivers/media/video/cs53l32a.c @@ -158,11 +158,10 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return 0; - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; client->driver = &i2c_driver; diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c index dc50b2129..563bea370 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -880,11 +880,10 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, #endif return 0; - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_cx25840; diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 7a4c45279..fc4cadeaf 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-blackbird.c,v 1.40 2006/01/01 17:17:39 mchehab Exp $ + * $Id: cx88-blackbird.c,v 1.41 2006/01/11 19:28:02 mchehab Exp $ * * Support for a cx23416 mpeg encoder via cx2388x host port. * "blackbird" reference design. @@ -1573,10 +1573,9 @@ static int mpeg_open(struct inode *inode, struct file *file) dprintk(1,"open minor=%d\n",minor); /* allocate + initialize per filehandle data */ - fh = kmalloc(sizeof(*fh),GFP_KERNEL); + fh = kzalloc(sizeof(*fh),GFP_KERNEL); if (NULL == fh) return -ENOMEM; - memset(fh,0,sizeof(*fh)); file->private_data = fh; fh->dev = dev; @@ -1712,10 +1711,9 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev, goto fail_core; err = -ENOMEM; - dev = kmalloc(sizeof(*dev),GFP_KERNEL); + dev = kzalloc(sizeof(*dev),GFP_KERNEL); if (NULL == dev) goto fail_core; - memset(dev,0,sizeof(*dev)); dev->pci = pci_dev; dev->core = core; dev->width = 720; diff --git a/linux/drivers/media/video/cx88/cx88-core.c b/linux/drivers/media/video/cx88/cx88-core.c index df19d7309..f2e18b89d 100644 --- a/linux/drivers/media/video/cx88/cx88-core.c +++ b/linux/drivers/media/video/cx88/cx88-core.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-core.c,v 1.52 2006/01/05 03:31:42 rmcc Exp $ + * $Id: cx88-core.c,v 1.53 2006/01/11 19:28:02 mchehab Exp $ * * device driver for Conexant 2388x based TV cards * driver core @@ -1095,11 +1095,10 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) up(&devlist); return core; } - core = kmalloc(sizeof(*core),GFP_KERNEL); + core = kzalloc(sizeof(*core),GFP_KERNEL); if (NULL == core) goto fail_unlock; - memset(core,0,sizeof(*core)); atomic_inc(&core->refcount); core->pci_bus = pci->bus->number; core->pci_slot = PCI_SLOT(pci->devfn); diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index a1cac4075..068b2e886 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-dvb.c,v 1.82 2006/01/08 10:42:39 pascoe Exp $ + * $Id: cx88-dvb.c,v 1.83 2006/01/11 19:28:02 mchehab Exp $ * * device driver for Conexant 2388x based TV cards * MPEG Transport Stream (DVB) routines @@ -659,10 +659,9 @@ static int __devinit dvb_probe(struct pci_dev *pci_dev, goto fail_core; err = -ENOMEM; - dev = kmalloc(sizeof(*dev),GFP_KERNEL); + dev = kzalloc(sizeof(*dev),GFP_KERNEL); if (NULL == dev) goto fail_core; - memset(dev,0,sizeof(*dev)); dev->pci = pci_dev; dev->core = core; diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index dcc4c1f61..a31fee5df 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-video.c,v 1.104 2006/01/01 17:17:39 mchehab Exp $ + * $Id: cx88-video.c,v 1.105 2006/01/11 19:28:02 mchehab Exp $ * * device driver for Conexant 2388x based TV cards * video4linux video interface @@ -1001,10 +1001,9 @@ static int video_open(struct inode *inode, struct file *file) minor,radio,v4l2_type_names[type]); /* allocate + initialize per filehandle data */ - fh = kmalloc(sizeof(*fh),GFP_KERNEL); + fh = kzalloc(sizeof(*fh),GFP_KERNEL); if (NULL == fh) return -ENOMEM; - memset(fh,0,sizeof(*fh)); file->private_data = fh; fh->dev = dev; fh->radio = radio; @@ -2104,10 +2103,9 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, struct cx88_core *core; int err; - dev = kmalloc(sizeof(*dev),GFP_KERNEL); + dev = kzalloc(sizeof(*dev),GFP_KERNEL); if (NULL == dev) return -ENOMEM; - memset(dev,0,sizeof(*dev)); /* pci init */ dev->pci = pci_dev; diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index 0e5489575..4dafd59e8 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -2054,12 +2054,11 @@ static int em28xx_usb_probe(struct usb_interface *interface, } /* allocate memory for our device state and initialize it */ - dev = kmalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) { em28xx_err(DRIVER_NAME ": out of memory!\n"); return -ENOMEM; } - memset(dev, 0, sizeof(*dev)); /* compute alternate max packet sizes */ uif = udev->actconfig->interface[0]; diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c index 512d15a4d..45ca02d47 100644 --- a/linux/drivers/media/video/saa7115.c +++ b/linux/drivers/media/video/saa7115.c @@ -1265,10 +1265,9 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return 0; - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa7115; @@ -1291,13 +1290,12 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) } v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name); - state = kmalloc(sizeof(struct saa7115_state), GFP_KERNEL); + state = kzalloc(sizeof(struct saa7115_state), GFP_KERNEL); i2c_set_clientdata(client, state); if (state == NULL) { kfree(client); return -ENOMEM; } - memset(state, 0, sizeof(struct saa7115_state)); state->std = V4L2_STD_NTSC; state->input = -1; state->enable = 1; diff --git a/linux/drivers/media/video/saa711x.c b/linux/drivers/media/video/saa711x.c index 02cfe9c3e..ba187966a 100644 --- a/linux/drivers/media/video/saa711x.c +++ b/linux/drivers/media/video/saa711x.c @@ -504,10 +504,9 @@ saa711x_detect_client (struct i2c_adapter *adapter, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return 0; - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa711x; @@ -521,12 +520,11 @@ saa711x_detect_client (struct i2c_adapter *adapter, #else strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); #endif - decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL); + decoder = kzalloc(sizeof(struct saa711x), GFP_KERNEL); if (decoder == NULL) { kfree(client); return -ENOMEM; } - memset(decoder, 0, sizeof(struct saa711x)); decoder->norm = VIDEO_MODE_NTSC; decoder->input = 0; decoder->enable = 1; diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c index 0b9e7151f..e4420ec85 100644 --- a/linux/drivers/media/video/saa7127.c +++ b/linux/drivers/media/video/saa7127.c @@ -706,11 +706,10 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return 0; - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa7127; @@ -732,7 +731,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) kfree(client); return 0; } - state = kmalloc(sizeof(struct saa7127_state), GFP_KERNEL); + state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL); if (state == NULL) { kfree(client); @@ -740,7 +739,6 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) } i2c_set_clientdata(client, state); - memset(state, 0, sizeof(struct saa7127_state)); /* Configure Encoder */ diff --git a/linux/drivers/media/video/saa7134/saa6752hs.c b/linux/drivers/media/video/saa7134/saa6752hs.c index dc49dbf68..eac8bfba9 100644 --- a/linux/drivers/media/video/saa7134/saa6752hs.c +++ b/linux/drivers/media/video/saa7134/saa6752hs.c @@ -526,9 +526,8 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, unsigned short f struct saa6752hs_state *h; - if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL))) + if (NULL == (h = kzalloc(sizeof(*h), GFP_KERNEL))) return -ENOMEM; - memset(h,0,sizeof(*h)); h->client = client_template; h->params = param_defaults; h->client.adapter = adap; diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index 90a80a25e..710885443 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-core.c,v 1.61 2006/01/08 01:20:04 rmcc Exp $ + * $Id: saa7134-core.c,v 1.62 2006/01/11 19:28:02 mchehab Exp $ * * device driver for philips saa7134 based TV cards * driver core @@ -872,10 +872,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, struct saa7134_mpeg_ops *mops; int err; - dev = kmalloc(sizeof(*dev),GFP_KERNEL); + dev = kzalloc(sizeof(*dev),GFP_KERNEL); if (NULL == dev) return -ENOMEM; - memset(dev,0,sizeof(*dev)); /* pci init */ dev->pci = pci_dev; diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c index e0b775d61..48c383a4b 100644 --- a/linux/drivers/media/video/saa7134/saa7134-video.c +++ b/linux/drivers/media/video/saa7134/saa7134-video.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-video.c,v 1.49 2006/01/01 17:17:39 mchehab Exp $ + * $Id: saa7134-video.c,v 1.50 2006/01/11 19:28:02 mchehab Exp $ * * device driver for philips saa7134 based TV cards * video4linux video interface @@ -1268,10 +1268,9 @@ static int video_open(struct inode *inode, struct file *file) v4l2_type_names[type]); /* allocate + initialize per filehandle data */ - fh = kmalloc(sizeof(*fh),GFP_KERNEL); + fh = kzalloc(sizeof(*fh),GFP_KERNEL); if (NULL == fh) return -ENOMEM; - memset(fh,0,sizeof(*fh)); file->private_data = fh; fh->dev = dev; fh->radio = radio; diff --git a/linux/drivers/media/video/tda7432.c b/linux/drivers/media/video/tda7432.c index b458518a5..8be350474 100644 --- a/linux/drivers/media/video/tda7432.c +++ b/linux/drivers/media/video/tda7432.c @@ -323,10 +323,9 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr, struct tda7432 *t; struct i2c_client *client; - t = kmalloc(sizeof *t,GFP_KERNEL); + t = kzalloc(sizeof *t,GFP_KERNEL); if (!t) return -ENOMEM; - memset(t,0,sizeof *t); client = &t->c; memcpy(client,&client_template,sizeof(struct i2c_client)); diff --git a/linux/drivers/media/video/tda9875.c b/linux/drivers/media/video/tda9875.c index d294c68a3..e61e36591 100644 --- a/linux/drivers/media/video/tda9875.c +++ b/linux/drivers/media/video/tda9875.c @@ -257,10 +257,9 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr, struct i2c_client *client; dprintk("In tda9875_attach\n"); - t = kmalloc(sizeof *t,GFP_KERNEL); + t = kzalloc(sizeof *t,GFP_KERNEL); if (!t) return -ENOMEM; - memset(t,0,sizeof *t); client = &t->c; memcpy(client,&client_template,sizeof(struct i2c_client)); diff --git a/linux/drivers/media/video/tda9887.c b/linux/drivers/media/video/tda9887.c index 38b9bfa85..01cacd11a 100644 --- a/linux/drivers/media/video/tda9887.c +++ b/linux/drivers/media/video/tda9887.c @@ -721,9 +721,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, client_template.adapter = adap; client_template.addr = addr; - if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) + if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL))) return -ENOMEM; - memset(t,0,sizeof(*t)); t->client = client_template; t->std = 0; diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 346d15466..0e4e7752a 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -1,5 +1,5 @@ /* - * $Id: tuner-core.c,v 1.96 2006/01/09 17:17:32 mchehab Exp $ + * $Id: tuner-core.c,v 1.97 2006/01/11 19:28:02 mchehab Exp $ * * i2c tv tuner chip device driver * core core, i.e. kernel interfaces, registering and so on @@ -446,10 +446,9 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, client_template.adapter = adap; client_template.addr = addr; - t = kmalloc(sizeof(struct tuner), GFP_KERNEL); + t = kzalloc(sizeof(struct tuner), GFP_KERNEL); if (NULL == t) return -ENOMEM; - memset(t, 0, sizeof(struct tuner)); memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); i2c_set_clientdata(&t->i2c, t); t->type = UNSET; diff --git a/linux/drivers/media/video/tvaudio.c b/linux/drivers/media/video/tvaudio.c index 35584f1d6..4e1bc3f52 100644 --- a/linux/drivers/media/video/tvaudio.c +++ b/linux/drivers/media/video/tvaudio.c @@ -1492,10 +1492,9 @@ static int chip_attach(struct i2c_adapter *adap, int addr, struct CHIPSTATE *chip; struct CHIPDESC *desc; - chip = kmalloc(sizeof(*chip),GFP_KERNEL); + chip = kzalloc(sizeof(*chip),GFP_KERNEL); if (!chip) return -ENOMEM; - memset(chip,0,sizeof(*chip)); memcpy(&chip->c,&client_template,sizeof(struct i2c_client)); chip->c.adapter = adap; chip->c.addr = addr; diff --git a/linux/drivers/media/video/tveeprom.c b/linux/drivers/media/video/tveeprom.c index c855b0ba4..9de1702b0 100644 --- a/linux/drivers/media/video/tveeprom.c +++ b/linux/drivers/media/video/tveeprom.c @@ -726,8 +726,7 @@ tveeprom_command(struct i2c_client *client, switch (cmd) { case 0: - buf = kmalloc(256,GFP_KERNEL); - memset(buf,0,256); + buf = kzalloc(256,GFP_KERNEL); tveeprom_read(client,buf,256); tveeprom_hauppauge_analog(client, &eeprom,buf); kfree(buf); @@ -758,10 +757,9 @@ tveeprom_detect_client(struct i2c_adapter *adapter, { struct i2c_client *client; - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (NULL == client) return -ENOMEM; - memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_tveeprom; diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c index 249be925a..bea373ec4 100644 --- a/linux/drivers/media/video/tvp5150.c +++ b/linux/drivers/media/video/tvp5150.c @@ -1142,12 +1142,11 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter, return -ENOMEM; memcpy(c, &client_template, sizeof(struct i2c_client)); - core = kmalloc(sizeof(struct tvp5150), GFP_KERNEL); + core = kzalloc(sizeof(struct tvp5150), GFP_KERNEL); if (core == 0) { kfree(c); return -ENOMEM; } - memset(core, 0, sizeof(struct tvp5150)); i2c_set_clientdata(c, core); rv = i2c_attach_client(c); diff --git a/linux/drivers/media/video/v4l1-compat.c b/linux/drivers/media/video/v4l1-compat.c index 02fe28a5e..ad94f3f26 100644 --- a/linux/drivers/media/video/v4l1-compat.c +++ b/linux/drivers/media/video/v4l1-compat.c @@ -1,5 +1,5 @@ /* - * $Id: v4l1-compat.c,v 1.15 2005/12/14 22:05:02 hverkuil Exp $ + * $Id: v4l1-compat.c,v 1.16 2006/01/11 19:28:02 mchehab Exp $ * * Video for Linux Two * Backward Compatibility Layer @@ -318,9 +318,8 @@ v4l_compat_translate_ioctl(struct inode *inode, { struct video_capability *cap = arg; - cap2 = kmalloc(sizeof(*cap2),GFP_KERNEL); + cap2 = kzalloc(sizeof(*cap2),GFP_KERNEL); memset(cap, 0, sizeof(*cap)); - memset(cap2, 0, sizeof(*cap2)); memset(&fbuf2, 0, sizeof(fbuf2)); err = drv(inode, file, VIDIOC_QUERYCAP, cap2); @@ -435,9 +434,8 @@ v4l_compat_translate_ioctl(struct inode *inode, { struct video_window *win = arg; - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); memset(win,0,sizeof(*win)); - memset(fmt2,0,sizeof(*fmt2)); fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; err = drv(inode, file, VIDIOC_G_FMT, fmt2); @@ -474,8 +472,7 @@ v4l_compat_translate_ioctl(struct inode *inode, struct video_window *win = arg; int err1,err2; - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); - memset(fmt2,0,sizeof(*fmt2)); + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); @@ -608,8 +605,7 @@ v4l_compat_translate_ioctl(struct inode *inode, pict->whiteness = get_v4l_control(inode, file, V4L2_CID_WHITENESS, drv); - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); - memset(fmt2,0,sizeof(*fmt2)); + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; err = drv(inode, file, VIDIOC_G_FMT, fmt2); if (err < 0) { @@ -638,8 +634,7 @@ v4l_compat_translate_ioctl(struct inode *inode, set_v4l_control(inode, file, V4L2_CID_WHITENESS, pict->whiteness, drv); - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); - memset(fmt2,0,sizeof(*fmt2)); + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; err = drv(inode, file, VIDIOC_G_FMT, fmt2); if (err < 0) @@ -874,9 +869,8 @@ v4l_compat_translate_ioctl(struct inode *inode, { struct video_mmap *mm = arg; - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); memset(&buf2,0,sizeof(buf2)); - memset(fmt2,0,sizeof(*fmt2)); fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; err = drv(inode, file, VIDIOC_G_FMT, fmt2); @@ -970,8 +964,7 @@ v4l_compat_translate_ioctl(struct inode *inode, { struct vbi_format *fmt = arg; - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); - memset(fmt2, 0, sizeof(*fmt2)); + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; err = drv(inode, file, VIDIOC_G_FMT, fmt2); @@ -1003,8 +996,7 @@ v4l_compat_translate_ioctl(struct inode *inode, break; } - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); - memset(fmt2, 0, sizeof(*fmt2)); + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; diff --git a/linux/drivers/media/video/video-buf.c b/linux/drivers/media/video/video-buf.c index 7f825dc4d..a2222b6b9 100644 --- a/linux/drivers/media/video/video-buf.c +++ b/linux/drivers/media/video/video-buf.c @@ -1,5 +1,5 @@ /* - * $Id: video-buf.c,v 1.24 2005/12/08 12:35:58 mchehab Exp $ + * $Id: video-buf.c,v 1.25 2006/01/11 19:28:02 mchehab Exp $ * * generic helper functions for video4linux capture buffers, to handle * memory management and PCI DMA. Right now bttv + saa7134 use it. @@ -54,10 +54,9 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) struct page *pg; int i; - sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); + sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); if (NULL == sglist) return NULL; - memset(sglist,0,sizeof(struct scatterlist)*nr_pages); for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { pg = vmalloc_to_page(virt); if (NULL == pg) @@ -82,10 +81,9 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) if (NULL == pages[0]) return NULL; - sglist = kmalloc(sizeof(*sglist) * nr_pages, GFP_KERNEL); + sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL); if (NULL == sglist) return NULL; - memset(sglist, 0, sizeof(*sglist) * nr_pages); if (NULL == pages[0]) goto nopage; @@ -291,9 +289,8 @@ void* videobuf_alloc(unsigned int size) { struct videobuf_buffer *vb; - vb = kmalloc(size,GFP_KERNEL); + vb = kzalloc(size,GFP_KERNEL); if (NULL != vb) { - memset(vb,0,size); videobuf_dma_init(&vb->dma); init_waitqueue_head(&vb->done); vb->magic = MAGIC_BUFFER; diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c index cc180733e..450fe9ddd 100644 --- a/linux/drivers/media/video/videodev.c +++ b/linux/drivers/media/video/videodev.c @@ -63,10 +63,7 @@ struct video_device *video_device_alloc(void) { struct video_device *vfd; - vfd = kmalloc(sizeof(*vfd),GFP_KERNEL); - if (NULL == vfd) - return NULL; - memset(vfd,0,sizeof(*vfd)); + vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); return vfd; } diff --git a/linux/drivers/media/video/wm8775.c b/linux/drivers/media/video/wm8775.c index 4fa692129..1e696133e 100644 --- a/linux/drivers/media/video/wm8775.c +++ b/linux/drivers/media/video/wm8775.c @@ -179,11 +179,10 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return 0; - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; client->driver = &i2c_driver; |