提交 7408187d 编写于 作者: P Panagiotis Issaris 提交者: Mauro Carvalho Chehab

V4L/DVB (3344a): Conversions from kmalloc+memset to k(z|c)alloc


Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: NPanagiotis Issaris <takis@issaris.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 0b3af1b6
...@@ -109,10 +109,9 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) ...@@ -109,10 +109,9 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
struct page *pg; struct page *pg;
int i; int i;
sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
if (NULL == sglist) if (NULL == sglist)
return NULL; return NULL;
memset(sglist,0,sizeof(struct scatterlist)*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);
if (NULL == pg) if (NULL == pg)
...@@ -306,15 +305,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent ...@@ -306,15 +305,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
struct saa7146_dev *dev; struct saa7146_dev *dev;
int err = -ENOMEM; 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) { if (!dev) {
ERR(("out of memory.\n")); ERR(("out of memory.\n"));
goto out; goto out;
} }
/* clear out mem for sure */
memset(dev, 0x0, sizeof(struct saa7146_dev));
DEB_EE(("pci:%p\n",pci)); DEB_EE(("pci:%p\n",pci));
err = pci_enable_device(pci); err = pci_enable_device(pci);
......
...@@ -239,13 +239,12 @@ static int fops_open(struct inode *inode, struct file *file) ...@@ -239,13 +239,12 @@ static int fops_open(struct inode *inode, struct file *file)
} }
/* allocate per open data */ /* allocate per open data */
fh = kmalloc(sizeof(*fh),GFP_KERNEL); fh = kzalloc(sizeof(*fh),GFP_KERNEL);
if (NULL == fh) { if (NULL == fh) {
DEB_S(("cannot allocate memory for per open data.\n")); DEB_S(("cannot allocate memory for per open data.\n"));
result = -ENOMEM; result = -ENOMEM;
goto out; goto out;
} }
memset(fh,0,sizeof(*fh));
file->private_data = fh; file->private_data = fh;
fh->dev = dev; fh->dev = dev;
...@@ -464,12 +463,11 @@ static struct video_device device_template = ...@@ -464,12 +463,11 @@ static struct video_device device_template =
int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) 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 ) { if( NULL == vv ) {
ERR(("out of memory. aborting.\n")); ERR(("out of memory. aborting.\n"));
return -1; return -1;
} }
memset(vv, 0x0, sizeof(*vv));
DEB_EE(("dev:%p\n",dev)); DEB_EE(("dev:%p\n",dev));
......
...@@ -220,20 +220,18 @@ EXPORT_SYMBOL(flexcop_reset_block_300); ...@@ -220,20 +220,18 @@ EXPORT_SYMBOL(flexcop_reset_block_300);
struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len)
{ {
void *bus; 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) { if (!fc) {
err("no memory"); err("no memory");
return NULL; 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) { if (!bus) {
err("no memory"); err("no memory");
kfree(fc); kfree(fc);
return NULL; return NULL;
} }
memset(bus, 0, bus_specific_len);
fc->bus_specific = bus; fc->bus_specific = bus;
......
...@@ -786,10 +786,9 @@ static int dvb_bt8xx_probe(struct device *dev) ...@@ -786,10 +786,9 @@ static int dvb_bt8xx_probe(struct device *dev)
struct pci_dev* bttv_pci_dev; struct pci_dev* bttv_pci_dev;
int ret; int ret;
if (!(card = kmalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
memset(card, 0, sizeof(*card));
init_MUTEX(&card->lock); init_MUTEX(&card->lock);
card->bttv_nr = sub->core->nr; card->bttv_nr = sub->core->nr;
strncpy(card->card_name, sub->core->name, sizeof(sub->core->name)); strncpy(card->card_name, sub->core->name, sizeof(sub->core->name));
......
...@@ -1649,21 +1649,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, ...@@ -1649,21 +1649,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
return -EINVAL; return -EINVAL;
/* initialise the system data */ /* initialise the system data */
if ((ca = if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) {
(struct dvb_ca_private *) kmalloc(sizeof(struct dvb_ca_private),
GFP_KERNEL)) == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto error; goto error;
} }
memset(ca, 0, sizeof(struct dvb_ca_private));
ca->pub = pubca; ca->pub = pubca;
ca->flags = flags; ca->flags = flags;
ca->slot_count = slot_count; 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; ret = -ENOMEM;
goto error; goto error;
} }
memset(ca->slot_info, 0, sizeof(struct dvb_ca_slot) * slot_count);
init_waitqueue_head(&ca->wait_queue); init_waitqueue_head(&ca->wait_queue);
ca->thread_pid = 0; ca->thread_pid = 0;
init_waitqueue_head(&ca->thread_queue); init_waitqueue_head(&ca->thread_queue);
......
...@@ -1024,13 +1024,12 @@ int dvb_register_frontend(struct dvb_adapter* dvb, ...@@ -1024,13 +1024,12 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
if (down_interruptible (&frontend_mutex)) if (down_interruptible (&frontend_mutex))
return -ERESTARTSYS; 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) { if (fe->frontend_priv == NULL) {
up(&frontend_mutex); up(&frontend_mutex);
return -ENOMEM; return -ENOMEM;
} }
fepriv = fe->frontend_priv; fepriv = fe->frontend_priv;
memset(fe->frontend_priv, 0, sizeof(struct dvb_frontend_private));
init_MUTEX (&fepriv->sem); init_MUTEX (&fepriv->sem);
init_waitqueue_head (&fepriv->wait_queue); init_waitqueue_head (&fepriv->wait_queue);
......
...@@ -156,10 +156,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) ...@@ -156,10 +156,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d)
struct dtt200u_fe_state* state = NULL; struct dtt200u_fe_state* state = NULL;
/* allocate memory for the internal state */ /* 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) if (state == NULL)
goto error; goto error;
memset(state,0,sizeof(struct dtt200u_fe_state));
deb_info("attaching frontend dtt200u\n"); deb_info("attaching frontend dtt200u\n");
......
...@@ -154,12 +154,11 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties ...@@ -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); 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) { if (d == NULL) {
err("no memory for 'struct dvb_usb_device'"); err("no memory for 'struct dvb_usb_device'");
return ret; return ret;
} }
memset(d,0,sizeof(struct dvb_usb_device));
d->udev = udev; d->udev = udev;
memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); 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 ...@@ -167,13 +166,12 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties
d->owner = owner; d->owner = owner;
if (d->props.size_of_priv > 0) { 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) { if (d->priv == NULL) {
err("no memory for priv in 'struct dvb_usb_device'"); err("no memory for priv in 'struct dvb_usb_device'");
kfree(d); kfree(d);
return -ENOMEM; return -ENOMEM;
} }
memset(d->priv,0,d->props.size_of_priv);
} }
usb_set_intfdata(intf, d); usb_set_intfdata(intf, d);
......
...@@ -175,15 +175,13 @@ static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, un ...@@ -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); 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; 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); kfree(d->buf_list);
return -ENOMEM; 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; d->state |= DVB_USB_STATE_URB_BUF;
...@@ -285,10 +283,9 @@ int dvb_usb_urb_init(struct dvb_usb_device *d) ...@@ -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)); usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint));
/* allocate the array for the data transfer URBs */ /* 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) if (d->urb_list == NULL)
return -ENOMEM; return -ENOMEM;
memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *));
d->state |= DVB_USB_STATE_URB_LIST; d->state |= DVB_USB_STATE_URB_LIST;
switch (d->props.urb.type) { switch (d->props.urb.type) {
......
...@@ -281,10 +281,9 @@ static struct dvb_frontend_ops vp702x_fe_ops; ...@@ -281,10 +281,9 @@ static struct dvb_frontend_ops vp702x_fe_ops;
struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) 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) if (s == NULL)
goto error; goto error;
memset(s,0,sizeof(struct vp702x_fe_state));
s->d = d; s->d = d;
s->fe.ops = &vp702x_fe_ops; s->fe.ops = &vp702x_fe_ops;
......
...@@ -145,10 +145,9 @@ static struct dvb_frontend_ops vp7045_fe_ops; ...@@ -145,10 +145,9 @@ static struct dvb_frontend_ops vp7045_fe_ops;
struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) 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) if (s == NULL)
goto error; goto error;
memset(s,0,sizeof(struct vp7045_fe_state));
s->d = d; s->d = d;
s->fe.ops = &vp7045_fe_ops; s->fe.ops = &vp7045_fe_ops;
......
...@@ -782,10 +782,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, ...@@ -782,10 +782,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config,
bcm3510_register_value v; bcm3510_register_value v;
/* allocate memory for the internal state */ /* 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) if (state == NULL)
goto error; goto error;
memset(state,0,sizeof(struct bcm3510_state));
/* setup the state */ /* setup the state */
......
...@@ -700,10 +700,9 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, ...@@ -700,10 +700,9 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
struct dib3000_state* state = NULL; struct dib3000_state* state = NULL;
/* allocate memory for the internal state */ /* 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) if (state == NULL)
goto error; goto error;
memset(state,0,sizeof(struct dib3000_state));
/* setup the state */ /* setup the state */
state->i2c = i2c; state->i2c = i2c;
......
...@@ -832,10 +832,9 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, ...@@ -832,10 +832,9 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
u16 devid; u16 devid;
/* allocate memory for the internal state */ /* 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) if (state == NULL)
goto error; goto error;
memset(state,0,sizeof(struct dib3000_state));
/* setup the state */ /* setup the state */
state->i2c = i2c; state->i2c = i2c;
......
...@@ -714,10 +714,9 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, ...@@ -714,10 +714,9 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
u8 buf[1]; u8 buf[1];
/* Allocate memory for the internal state */ /* 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) if (state == NULL)
goto error; goto error;
memset(state,0,sizeof(*state));
/* Setup the state */ /* Setup the state */
state->config = config; state->config = config;
......
...@@ -535,9 +535,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, ...@@ -535,9 +535,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config,
struct mt352_state* state = NULL; struct mt352_state* state = NULL;
/* allocate memory for the internal state */ /* 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; if (state == NULL) goto error;
memset(state,0,sizeof(*state));
/* setup the state */ /* setup the state */
state->i2c = i2c; state->i2c = i2c;
......
...@@ -1110,10 +1110,9 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, ...@@ -1110,10 +1110,9 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config,
u8 buf [] = {0,0,0,0,0}; u8 buf [] = {0,0,0,0,0};
/* allocate memory for the internal state */ /* 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) if (state == NULL)
goto error; goto error;
memset(state,0,sizeof(*state));
/* setup the state */ /* setup the state */
state->config = config; state->config = config;
......
...@@ -584,11 +584,10 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, ...@@ -584,11 +584,10 @@ static int __devinit pluto2_probe(struct pci_dev *pdev,
struct dmx_demux *dmx; struct dmx_demux *dmx;
int ret = -ENOMEM; int ret = -ENOMEM;
pluto = kmalloc(sizeof(struct pluto), GFP_KERNEL); pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL);
if (!pluto) if (!pluto)
goto out; goto out;
memset(pluto, 0, sizeof(struct pluto));
pluto->pdev = pdev; pluto->pdev = pdev;
ret = pci_enable_device(pdev); ret = pci_enable_device(pdev);
......
...@@ -2565,14 +2565,12 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d ...@@ -2565,14 +2565,12 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d
} }
/* prepare the av7110 device struct */ /* prepare the av7110 device struct */
av7110 = kmalloc(sizeof(struct av7110), GFP_KERNEL); av7110 = kzalloc(sizeof(struct av7110), GFP_KERNEL);
if (!av7110) { if (!av7110) {
dprintk(1, "out of memory\n"); dprintk(1, "out of memory\n");
return -ENOMEM; return -ENOMEM;
} }
memset(av7110, 0, sizeof(struct av7110));
av7110->card_name = (char*) pci_ext->ext_priv; av7110->card_name = (char*) pci_ext->ext_priv;
av7110->dev = dev; av7110->dev = dev;
dev->ext_priv = av7110; dev->ext_priv = av7110;
......
...@@ -1027,11 +1027,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio ...@@ -1027,11 +1027,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
dprintk(2, "dev: %p\n", dev); 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; return -ENOMEM;
memset(budget_av, 0, sizeof(struct budget_av));
budget_av->has_saa7113 = 0; budget_av->has_saa7113 = 0;
budget_av->budget.ci_present = 0; budget_av->budget.ci_present = 0;
......
...@@ -1489,11 +1489,9 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -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 (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; return -ENOMEM;
memset(ttusb, 0, sizeof(struct ttusb));
ttusb->dev = udev; ttusb->dev = udev;
ttusb->c = 0; ttusb->c = 0;
ttusb->mux_state = 0; ttusb->mux_state = 0;
......
...@@ -1606,15 +1606,13 @@ static int ttusb_dec_probe(struct usb_interface *intf, ...@@ -1606,15 +1606,13 @@ static int ttusb_dec_probe(struct usb_interface *intf,
udev = interface_to_usbdev(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__); printk("%s: couldn't allocate memory.\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
usb_set_intfdata(intf, (void *)dec); usb_set_intfdata(intf, (void *)dec);
memset(dec, 0, sizeof(struct ttusb_dec));
switch (le16_to_cpu(id->idProduct)) { switch (le16_to_cpu(id->idProduct)) {
case 0x1006: case 0x1006:
ttusb_dec_set_model(dec, TTUSB_DEC3000S); ttusb_dec_set_model(dec, TTUSB_DEC3000S);
......
...@@ -318,11 +318,10 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci ...@@ -318,11 +318,10 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
struct gemtek_pci_card *card; struct gemtek_pci_card *card;
struct video_device *devradio; struct video_device *devradio;
if ( (card = kmalloc( sizeof( struct gemtek_pci_card ), GFP_KERNEL )) == NULL ) { if ( (card = kzalloc( sizeof( struct gemtek_pci_card ), GFP_KERNEL )) == NULL ) {
printk( KERN_ERR "gemtek_pci: out of memory\n" ); printk( KERN_ERR "gemtek_pci: out of memory\n" );
return -ENOMEM; return -ENOMEM;
} }
memset( card, 0, sizeof( struct gemtek_pci_card ) );
if ( pci_enable_device( pci_dev ) ) if ( pci_enable_device( pci_dev ) )
goto err_pci; goto err_pci;
......
...@@ -413,10 +413,9 @@ adv7170_detect_client (struct i2c_adapter *adapter, ...@@ -413,10 +413,9 @@ adv7170_detect_client (struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_adv7170; client->driver = &i2c_driver_adv7170;
...@@ -433,12 +432,11 @@ adv7170_detect_client (struct i2c_adapter *adapter, ...@@ -433,12 +432,11 @@ adv7170_detect_client (struct i2c_adapter *adapter,
} }
strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client)));
encoder = kmalloc(sizeof(struct adv7170), GFP_KERNEL); encoder = kzalloc(sizeof(struct adv7170), GFP_KERNEL);
if (encoder == NULL) { if (encoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(encoder, 0, sizeof(struct adv7170));
encoder->norm = VIDEO_MODE_NTSC; encoder->norm = VIDEO_MODE_NTSC;
encoder->input = 0; encoder->input = 0;
encoder->enable = 1; encoder->enable = 1;
......
...@@ -463,10 +463,9 @@ adv7175_detect_client (struct i2c_adapter *adapter, ...@@ -463,10 +463,9 @@ adv7175_detect_client (struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_adv7175; client->driver = &i2c_driver_adv7175;
...@@ -483,12 +482,11 @@ adv7175_detect_client (struct i2c_adapter *adapter, ...@@ -483,12 +482,11 @@ adv7175_detect_client (struct i2c_adapter *adapter,
} }
strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client)));
encoder = kmalloc(sizeof(struct adv7175), GFP_KERNEL); encoder = kzalloc(sizeof(struct adv7175), GFP_KERNEL);
if (encoder == NULL) { if (encoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(encoder, 0, sizeof(struct adv7175));
encoder->norm = VIDEO_MODE_PAL; encoder->norm = VIDEO_MODE_PAL;
encoder->input = 0; encoder->input = 0;
encoder->enable = 1; encoder->enable = 1;
......
...@@ -528,21 +528,18 @@ bt819_detect_client (struct i2c_adapter *adapter, ...@@ -528,21 +528,18 @@ bt819_detect_client (struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_bt819; client->driver = &i2c_driver_bt819;
decoder = kmalloc(sizeof(struct bt819), GFP_KERNEL); decoder = kzalloc(sizeof(struct bt819), GFP_KERNEL);
if (decoder == NULL) { if (decoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(decoder, 0, sizeof(struct bt819));
decoder->norm = VIDEO_MODE_NTSC; decoder->norm = VIDEO_MODE_NTSC;
decoder->input = 0; decoder->input = 0;
decoder->enable = 1; decoder->enable = 1;
......
...@@ -167,9 +167,8 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -167,9 +167,8 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap; client_template.adapter = adap;
client_template.addr = addr; client_template.addr = addr;
if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
memset(t,0,sizeof(*t));
t->client = client_template; t->client = client_template;
i2c_set_clientdata(&t->client, t); i2c_set_clientdata(&t->client, t);
i2c_attach_client(&t->client); i2c_attach_client(&t->client);
......
...@@ -316,21 +316,19 @@ bt856_detect_client (struct i2c_adapter *adapter, ...@@ -316,21 +316,19 @@ bt856_detect_client (struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_bt856; client->driver = &i2c_driver_bt856;
strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client))); strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client)));
encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL); encoder = kzalloc(sizeof(struct bt856), GFP_KERNEL);
if (encoder == NULL) { if (encoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(encoder, 0, sizeof(struct bt856));
encoder->norm = VIDEO_MODE_NTSC; encoder->norm = VIDEO_MODE_NTSC;
encoder->enable = 1; encoder->enable = 1;
i2c_set_clientdata(client, encoder); i2c_set_clientdata(client, encoder);
......
...@@ -64,10 +64,9 @@ int bttv_sub_add_device(struct bttv_core *core, char *name) ...@@ -64,10 +64,9 @@ int bttv_sub_add_device(struct bttv_core *core, char *name)
struct bttv_sub_device *sub; struct bttv_sub_device *sub;
int err; int err;
sub = kmalloc(sizeof(*sub),GFP_KERNEL); sub = kzalloc(sizeof(*sub),GFP_KERNEL);
if (NULL == sub) if (NULL == sub)
return -ENOMEM; return -ENOMEM;
memset(sub,0,sizeof(*sub));
sub->core = core; sub->core = core;
sub->dev.parent = &core->pci->dev; sub->dev.parent = &core->pci->dev;
......
...@@ -702,12 +702,11 @@ static int cpia_pp_register(struct parport *port) ...@@ -702,12 +702,11 @@ static int cpia_pp_register(struct parport *port)
return -ENXIO; return -ENXIO;
} }
cam = kmalloc(sizeof(struct pp_cam_entry), GFP_KERNEL); cam = kzalloc(sizeof(struct pp_cam_entry), GFP_KERNEL);
if (cam == NULL) { if (cam == NULL) {
LOG("failed to allocate camera structure\n"); LOG("failed to allocate camera structure\n");
return -ENOMEM; return -ENOMEM;
} }
memset(cam,0,sizeof(struct pp_cam_entry));
pdev = parport_register_device(port, "cpia_pp", NULL, NULL, pdev = parport_register_device(port, "cpia_pp", NULL, NULL,
NULL, 0, cam); NULL, 0, cam);
......
...@@ -499,14 +499,12 @@ static int cpia_probe(struct usb_interface *intf, ...@@ -499,14 +499,12 @@ static int cpia_probe(struct usb_interface *intf,
printk(KERN_INFO "USB CPiA camera found\n"); printk(KERN_INFO "USB CPiA camera found\n");
ucpia = kmalloc(sizeof(*ucpia), GFP_KERNEL); ucpia = kzalloc(sizeof(*ucpia), GFP_KERNEL);
if (!ucpia) { if (!ucpia) {
printk(KERN_ERR "couldn't kmalloc cpia struct\n"); printk(KERN_ERR "couldn't kmalloc cpia struct\n");
return -ENOMEM; return -ENOMEM;
} }
memset(ucpia, 0, sizeof(*ucpia));
ucpia->dev = udev; ucpia->dev = udev;
ucpia->iface = interface->desc.bInterfaceNumber; ucpia->iface = interface->desc.bInterfaceNumber;
init_waitqueue_head(&ucpia->wq_stream); init_waitqueue_head(&ucpia->wq_stream);
......
...@@ -141,11 +141,10 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -141,11 +141,10 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver; client->driver = &i2c_driver;
......
...@@ -862,11 +862,10 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, ...@@ -862,11 +862,10 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_cx25840; client->driver = &i2c_driver_cx25840;
......
...@@ -1539,10 +1539,9 @@ static int mpeg_open(struct inode *inode, struct file *file) ...@@ -1539,10 +1539,9 @@ static int mpeg_open(struct inode *inode, struct file *file)
dprintk(1,"open minor=%d\n",minor); dprintk(1,"open minor=%d\n",minor);
/* allocate + initialize per filehandle data */ /* allocate + initialize per filehandle data */
fh = kmalloc(sizeof(*fh),GFP_KERNEL); fh = kzalloc(sizeof(*fh),GFP_KERNEL);
if (NULL == fh) if (NULL == fh)
return -ENOMEM; return -ENOMEM;
memset(fh,0,sizeof(*fh));
file->private_data = fh; file->private_data = fh;
fh->dev = dev; fh->dev = dev;
...@@ -1678,10 +1677,9 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev, ...@@ -1678,10 +1677,9 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev,
goto fail_core; goto fail_core;
err = -ENOMEM; err = -ENOMEM;
dev = kmalloc(sizeof(*dev),GFP_KERNEL); dev = kzalloc(sizeof(*dev),GFP_KERNEL);
if (NULL == dev) if (NULL == dev)
goto fail_core; goto fail_core;
memset(dev,0,sizeof(*dev));
dev->pci = pci_dev; dev->pci = pci_dev;
dev->core = core; dev->core = core;
dev->width = 720; dev->width = 720;
......
...@@ -1050,11 +1050,10 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) ...@@ -1050,11 +1050,10 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
up(&devlist); up(&devlist);
return core; return core;
} }
core = kmalloc(sizeof(*core),GFP_KERNEL); core = kzalloc(sizeof(*core),GFP_KERNEL);
if (NULL == core) if (NULL == core)
goto fail_unlock; goto fail_unlock;
memset(core,0,sizeof(*core));
atomic_inc(&core->refcount); atomic_inc(&core->refcount);
core->pci_bus = pci->bus->number; core->pci_bus = pci->bus->number;
core->pci_slot = PCI_SLOT(pci->devfn); core->pci_slot = PCI_SLOT(pci->devfn);
......
...@@ -657,10 +657,9 @@ static int __devinit dvb_probe(struct pci_dev *pci_dev, ...@@ -657,10 +657,9 @@ static int __devinit dvb_probe(struct pci_dev *pci_dev,
goto fail_core; goto fail_core;
err = -ENOMEM; err = -ENOMEM;
dev = kmalloc(sizeof(*dev),GFP_KERNEL); dev = kzalloc(sizeof(*dev),GFP_KERNEL);
if (NULL == dev) if (NULL == dev)
goto fail_core; goto fail_core;
memset(dev,0,sizeof(*dev));
dev->pci = pci_dev; dev->pci = pci_dev;
dev->core = core; dev->core = core;
......
...@@ -750,10 +750,9 @@ static int video_open(struct inode *inode, struct file *file) ...@@ -750,10 +750,9 @@ static int video_open(struct inode *inode, struct file *file)
minor,radio,v4l2_type_names[type]); minor,radio,v4l2_type_names[type]);
/* allocate + initialize per filehandle data */ /* allocate + initialize per filehandle data */
fh = kmalloc(sizeof(*fh),GFP_KERNEL); fh = kzalloc(sizeof(*fh),GFP_KERNEL);
if (NULL == fh) if (NULL == fh)
return -ENOMEM; return -ENOMEM;
memset(fh,0,sizeof(*fh));
file->private_data = fh; file->private_data = fh;
fh->dev = dev; fh->dev = dev;
fh->radio = radio; fh->radio = radio;
...@@ -1809,10 +1808,9 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, ...@@ -1809,10 +1808,9 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
struct cx88_core *core; struct cx88_core *core;
int err; int err;
dev = kmalloc(sizeof(*dev),GFP_KERNEL); dev = kzalloc(sizeof(*dev),GFP_KERNEL);
if (NULL == dev) if (NULL == dev)
return -ENOMEM; return -ENOMEM;
memset(dev,0,sizeof(*dev));
/* pci init */ /* pci init */
dev->pci = pci_dev; dev->pci = pci_dev;
......
...@@ -94,12 +94,11 @@ static int dpc_probe(struct saa7146_dev* dev) ...@@ -94,12 +94,11 @@ static int dpc_probe(struct saa7146_dev* dev)
struct i2c_client *client; struct i2c_client *client;
struct list_head *item; struct list_head *item;
dpc = (struct dpc*)kmalloc(sizeof(struct dpc), GFP_KERNEL); dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL);
if( NULL == dpc ) { if( NULL == dpc ) {
printk("dpc_v4l2.o: dpc_probe: not enough kernel memory.\n"); printk("dpc_v4l2.o: dpc_probe: not enough kernel memory.\n");
return -ENOMEM; return -ENOMEM;
} }
memset(dpc, 0x0, sizeof(struct dpc));
/* FIXME: enable i2c-port pins, video-port-pins /* FIXME: enable i2c-port pins, video-port-pins
video port pins should be enabled here ?! */ video port pins should be enabled here ?! */
......
...@@ -1861,12 +1861,11 @@ static int em28xx_usb_probe(struct usb_interface *interface, ...@@ -1861,12 +1861,11 @@ static int em28xx_usb_probe(struct usb_interface *interface,
} }
/* allocate memory for our device state and initialize it */ /* allocate memory for our device state and initialize it */
dev = kmalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL) {
em28xx_err(DRIVER_NAME ": out of memory!\n"); em28xx_err(DRIVER_NAME ": out of memory!\n");
return -ENOMEM; return -ENOMEM;
} }
memset(dev, 0, sizeof(*dev));
/* compute alternate max packet sizes */ /* compute alternate max packet sizes */
uif = udev->actconfig->interface[0]; uif = udev->actconfig->interface[0];
......
...@@ -240,12 +240,11 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d ...@@ -240,12 +240,11 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
DEB_EE((".\n")); DEB_EE((".\n"));
hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL); hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
if (NULL == hexium) { if (NULL == hexium) {
printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); printk("hexium_gemini: not enough kernel memory in hexium_attach().\n");
return -ENOMEM; return -ENOMEM;
} }
memset(hexium, 0x0, sizeof(struct hexium));
dev->ext_priv = hexium; dev->ext_priv = hexium;
/* enable i2c-port pins */ /* enable i2c-port pins */
......
...@@ -224,12 +224,11 @@ static int hexium_probe(struct saa7146_dev *dev) ...@@ -224,12 +224,11 @@ static int hexium_probe(struct saa7146_dev *dev)
return -EFAULT; return -EFAULT;
} }
hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL); hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
if (NULL == hexium) { if (NULL == hexium) {
printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); printk("hexium_orion: hexium_probe: not enough kernel memory.\n");
return -ENOMEM; return -ENOMEM;
} }
memset(hexium, 0x0, sizeof(struct hexium));
/* enable i2c-port pins */ /* enable i2c-port pins */
saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
......
...@@ -289,18 +289,15 @@ static int indycam_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -289,18 +289,15 @@ static int indycam_attach(struct i2c_adapter *adap, int addr, int kind)
printk(KERN_INFO "SGI IndyCam driver version %s\n", printk(KERN_INFO "SGI IndyCam driver version %s\n",
INDYCAM_MODULE_VERSION); INDYCAM_MODULE_VERSION);
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (!client) if (!client)
return -ENOMEM; return -ENOMEM;
camera = kmalloc(sizeof(struct indycam), GFP_KERNEL); camera = kzalloc(sizeof(struct indycam), GFP_KERNEL);
if (!camera) { if (!camera) {
err = -ENOMEM; err = -ENOMEM;
goto out_free_client; goto out_free_client;
} }
memset(client, 0, sizeof(struct i2c_client));
memset(camera, 0, sizeof(struct indycam));
client->addr = addr; client->addr = addr;
client->adapter = adap; client->adapter = adap;
client->driver = &i2c_driver_indycam; client->driver = &i2c_driver_indycam;
......
...@@ -177,12 +177,11 @@ static int mxb_probe(struct saa7146_dev* dev) ...@@ -177,12 +177,11 @@ static int mxb_probe(struct saa7146_dev* dev)
return -ENODEV; return -ENODEV;
} }
mxb = (struct mxb*)kmalloc(sizeof(struct mxb), GFP_KERNEL); mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
if( NULL == mxb ) { if( NULL == mxb ) {
DEB_D(("not enough kernel memory.\n")); DEB_D(("not enough kernel memory.\n"));
return -ENOMEM; return -ENOMEM;
} }
memset(mxb, 0x0, sizeof(struct mxb));
mxb->i2c_adapter = (struct i2c_adapter) { mxb->i2c_adapter = (struct i2c_adapter) {
.class = I2C_CLASS_TV_ANALOG, .class = I2C_CLASS_TV_ANALOG,
......
...@@ -178,10 +178,9 @@ static int ov6x20_init(struct i2c_client *c) ...@@ -178,10 +178,9 @@ static int ov6x20_init(struct i2c_client *c)
if (rc < 0) if (rc < 0)
return rc; return rc;
ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
if (!s) if (!s)
return -ENOMEM; return -ENOMEM;
memset(s, 0, sizeof *s);
s->auto_brt = 1; s->auto_brt = 1;
s->auto_exp = 1; s->auto_exp = 1;
......
...@@ -141,10 +141,9 @@ static int ov6x30_init(struct i2c_client *c) ...@@ -141,10 +141,9 @@ static int ov6x30_init(struct i2c_client *c)
if (rc < 0) if (rc < 0)
return rc; return rc;
ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
if (!s) if (!s)
return -ENOMEM; return -ENOMEM;
memset(s, 0, sizeof *s);
s->auto_brt = 1; s->auto_brt = 1;
s->auto_exp = 1; s->auto_exp = 1;
......
...@@ -105,10 +105,9 @@ static int ov76be_init(struct i2c_client *c) ...@@ -105,10 +105,9 @@ static int ov76be_init(struct i2c_client *c)
if (rc < 0) if (rc < 0)
return rc; return rc;
ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
if (!s) if (!s)
return -ENOMEM; return -ENOMEM;
memset(s, 0, sizeof *s);
s->auto_brt = 1; s->auto_brt = 1;
s->auto_exp = 1; s->auto_exp = 1;
......
...@@ -115,10 +115,9 @@ static int ov7x10_init(struct i2c_client *c) ...@@ -115,10 +115,9 @@ static int ov7x10_init(struct i2c_client *c)
if (rc < 0) if (rc < 0)
return rc; return rc;
ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
if (!s) if (!s)
return -ENOMEM; return -ENOMEM;
memset(s, 0, sizeof *s);
s->auto_brt = 1; s->auto_brt = 1;
s->auto_exp = 1; s->auto_exp = 1;
......
...@@ -232,10 +232,9 @@ static int ov7x20_init(struct i2c_client *c) ...@@ -232,10 +232,9 @@ static int ov7x20_init(struct i2c_client *c)
if (rc < 0) if (rc < 0)
return rc; return rc;
ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
if (!s) if (!s)
return -ENOMEM; return -ENOMEM;
memset(s, 0, sizeof *s);
s->auto_brt = 1; s->auto_brt = 1;
s->auto_exp = DFL_AUTO_EXP; s->auto_exp = DFL_AUTO_EXP;
......
...@@ -316,12 +316,11 @@ static int ovcamchip_attach(struct i2c_adapter *adap) ...@@ -316,12 +316,11 @@ static int ovcamchip_attach(struct i2c_adapter *adap)
c->adapter = adap; c->adapter = adap;
strcpy(c->name, "OV????"); strcpy(c->name, "OV????");
ov = kmalloc(sizeof *ov, GFP_KERNEL); ov = kzalloc(sizeof *ov, GFP_KERNEL);
if (!ov) { if (!ov) {
rc = -ENOMEM; rc = -ENOMEM;
goto no_ov; goto no_ov;
} }
memset(ov, 0, sizeof *ov);
i2c_set_clientdata(c, ov); i2c_set_clientdata(c, ov);
rc = ovcamchip_detect(c); rc = ovcamchip_detect(c);
......
...@@ -83,13 +83,12 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -83,13 +83,12 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap; client_template.adapter = adap;
client_template.addr = addr; client_template.addr = addr;
memcpy(client, &client_template, sizeof(*client)); memcpy(client, &client_template, sizeof(*client));
t = kmalloc(sizeof(*t), GFP_KERNEL); t = kzalloc(sizeof(*t), GFP_KERNEL);
if(t==NULL) if(t==NULL)
{ {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(t, 0, sizeof(*t));
strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);
init_MUTEX(&t->lock); init_MUTEX(&t->lock);
......
...@@ -151,13 +151,12 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -151,13 +151,12 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap; client_template.adapter = adap;
client_template.addr = addr; client_template.addr = addr;
memcpy(client, &client_template, sizeof(*client)); memcpy(client, &client_template, sizeof(*client));
t = kmalloc(sizeof(*t), GFP_KERNEL); t = kzalloc(sizeof(*t), GFP_KERNEL);
if(t==NULL) if(t==NULL)
{ {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(t, 0, sizeof(*t));
strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);
init_MUTEX(&t->lock); init_MUTEX(&t->lock);
...@@ -165,7 +164,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -165,7 +164,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
* Now create a video4linux device * Now create a video4linux device
*/ */
vd = (struct video_device *)kmalloc(sizeof(struct video_device), GFP_KERNEL); vd = kmalloc(sizeof(struct video_device), GFP_KERNEL);
if(vd==NULL) if(vd==NULL)
{ {
kfree(t); kfree(t);
......
...@@ -494,21 +494,19 @@ saa7110_detect_client (struct i2c_adapter *adapter, ...@@ -494,21 +494,19 @@ saa7110_detect_client (struct i2c_adapter *adapter,
I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_saa7110; client->driver = &i2c_driver_saa7110;
strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client)));
decoder = kmalloc(sizeof(struct saa7110), GFP_KERNEL); decoder = kzalloc(sizeof(struct saa7110), GFP_KERNEL);
if (decoder == 0) { if (decoder == 0) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(decoder, 0, sizeof(struct saa7110));
decoder->norm = VIDEO_MODE_PAL; decoder->norm = VIDEO_MODE_PAL;
decoder->input = 0; decoder->input = 0;
decoder->enable = 1; decoder->enable = 1;
......
...@@ -511,21 +511,19 @@ saa7111_detect_client (struct i2c_adapter *adapter, ...@@ -511,21 +511,19 @@ saa7111_detect_client (struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_saa7111; client->driver = &i2c_driver_saa7111;
strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client))); strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client)));
decoder = kmalloc(sizeof(struct saa7111), GFP_KERNEL); decoder = kzalloc(sizeof(struct saa7111), GFP_KERNEL);
if (decoder == NULL) { if (decoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(decoder, 0, sizeof(struct saa7111));
decoder->norm = VIDEO_MODE_NTSC; decoder->norm = VIDEO_MODE_NTSC;
decoder->input = 0; decoder->input = 0;
decoder->enable = 1; decoder->enable = 1;
......
...@@ -852,21 +852,19 @@ saa7114_detect_client (struct i2c_adapter *adapter, ...@@ -852,21 +852,19 @@ saa7114_detect_client (struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_saa7114; client->driver = &i2c_driver_saa7114;
strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client))); strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client)));
decoder = kmalloc(sizeof(struct saa7114), GFP_KERNEL); decoder = kzalloc(sizeof(struct saa7114), GFP_KERNEL);
if (decoder == NULL) { if (decoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(decoder, 0, sizeof(struct saa7114));
decoder->norm = VIDEO_MODE_NTSC; decoder->norm = VIDEO_MODE_NTSC;
decoder->input = -1; decoder->input = -1;
decoder->enable = 1; decoder->enable = 1;
......
...@@ -1249,10 +1249,9 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -1249,10 +1249,9 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_saa7115; client->driver = &i2c_driver_saa7115;
...@@ -1272,13 +1271,12 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -1272,13 +1271,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); 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); i2c_set_clientdata(client, state);
if (state == NULL) { if (state == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(state, 0, sizeof(struct saa7115_state));
state->std = V4L2_STD_NTSC; state->std = V4L2_STD_NTSC;
state->input = -1; state->input = -1;
state->enable = 1; state->enable = 1;
......
...@@ -487,20 +487,18 @@ saa711x_detect_client (struct i2c_adapter *adapter, ...@@ -487,20 +487,18 @@ saa711x_detect_client (struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_saa711x; client->driver = &i2c_driver_saa711x;
strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client)));
decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL); decoder = kzalloc(sizeof(struct saa711x), GFP_KERNEL);
if (decoder == NULL) { if (decoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(decoder, 0, sizeof(struct saa711x));
decoder->norm = VIDEO_MODE_NTSC; decoder->norm = VIDEO_MODE_NTSC;
decoder->input = 0; decoder->input = 0;
decoder->enable = 1; decoder->enable = 1;
......
...@@ -689,11 +689,10 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -689,11 +689,10 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_saa7127; client->driver = &i2c_driver_saa7127;
...@@ -712,7 +711,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -712,7 +711,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
kfree(client); kfree(client);
return 0; return 0;
} }
state = kmalloc(sizeof(struct saa7127_state), GFP_KERNEL); state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL);
if (state == NULL) { if (state == NULL) {
kfree(client); kfree(client);
...@@ -720,7 +719,6 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -720,7 +719,6 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
} }
i2c_set_clientdata(client, state); i2c_set_clientdata(client, state);
memset(state, 0, sizeof(struct saa7127_state));
/* Configure Encoder */ /* Configure Encoder */
......
...@@ -511,9 +511,8 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -511,9 +511,8 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
struct saa6752hs_state *h; struct saa6752hs_state *h;
if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL))) if (NULL == (h = kzalloc(sizeof(*h), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
memset(h,0,sizeof(*h));
h->client = client_template; h->client = client_template;
h->params = param_defaults; h->params = param_defaults;
h->client.adapter = adap; h->client.adapter = adap;
......
...@@ -803,10 +803,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -803,10 +803,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
struct saa7134_mpeg_ops *mops; struct saa7134_mpeg_ops *mops;
int err; int err;
dev = kmalloc(sizeof(*dev),GFP_KERNEL); dev = kzalloc(sizeof(*dev),GFP_KERNEL);
if (NULL == dev) if (NULL == dev)
return -ENOMEM; return -ENOMEM;
memset(dev,0,sizeof(*dev));
/* pci init */ /* pci init */
dev->pci = pci_dev; dev->pci = pci_dev;
......
...@@ -1264,10 +1264,9 @@ static int video_open(struct inode *inode, struct file *file) ...@@ -1264,10 +1264,9 @@ static int video_open(struct inode *inode, struct file *file)
v4l2_type_names[type]); v4l2_type_names[type]);
/* allocate + initialize per filehandle data */ /* allocate + initialize per filehandle data */
fh = kmalloc(sizeof(*fh),GFP_KERNEL); fh = kzalloc(sizeof(*fh),GFP_KERNEL);
if (NULL == fh) if (NULL == fh)
return -ENOMEM; return -ENOMEM;
memset(fh,0,sizeof(*fh));
file->private_data = fh; file->private_data = fh;
fh->dev = dev; fh->dev = dev;
fh->radio = radio; fh->radio = radio;
......
...@@ -408,21 +408,19 @@ saa7185_detect_client (struct i2c_adapter *adapter, ...@@ -408,21 +408,19 @@ saa7185_detect_client (struct i2c_adapter *adapter,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_saa7185; client->driver = &i2c_driver_saa7185;
strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client))); strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client)));
encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL); encoder = kzalloc(sizeof(struct saa7185), GFP_KERNEL);
if (encoder == NULL) { if (encoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(encoder, 0, sizeof(struct saa7185));
encoder->norm = VIDEO_MODE_NTSC; encoder->norm = VIDEO_MODE_NTSC;
encoder->enable = 1; encoder->enable = 1;
i2c_set_clientdata(client, encoder); i2c_set_clientdata(client, encoder);
......
...@@ -571,18 +571,15 @@ static int saa7191_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -571,18 +571,15 @@ static int saa7191_attach(struct i2c_adapter *adap, int addr, int kind)
printk(KERN_INFO "Philips SAA7191 driver version %s\n", printk(KERN_INFO "Philips SAA7191 driver version %s\n",
SAA7191_MODULE_VERSION); SAA7191_MODULE_VERSION);
client = kmalloc(sizeof(*client), GFP_KERNEL); client = kzalloc(sizeof(*client), GFP_KERNEL);
if (!client) if (!client)
return -ENOMEM; return -ENOMEM;
decoder = kmalloc(sizeof(*decoder), GFP_KERNEL); decoder = kzalloc(sizeof(*decoder), GFP_KERNEL);
if (!decoder) { if (!decoder) {
err = -ENOMEM; err = -ENOMEM;
goto out_free_client; goto out_free_client;
} }
memset(client, 0, sizeof(struct i2c_client));
memset(decoder, 0, sizeof(struct saa7191));
client->addr = addr; client->addr = addr;
client->adapter = adap; client->adapter = adap;
client->driver = &i2c_driver_saa7191; client->driver = &i2c_driver_saa7191;
......
...@@ -300,10 +300,9 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -300,10 +300,9 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr, int kind)
struct tda7432 *t; struct tda7432 *t;
struct i2c_client *client; struct i2c_client *client;
t = kmalloc(sizeof *t,GFP_KERNEL); t = kzalloc(sizeof *t,GFP_KERNEL);
if (!t) if (!t)
return -ENOMEM; return -ENOMEM;
memset(t,0,sizeof *t);
client = &t->c; client = &t->c;
memcpy(client,&client_template,sizeof(struct i2c_client)); memcpy(client,&client_template,sizeof(struct i2c_client));
......
...@@ -232,10 +232,9 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -232,10 +232,9 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr, int kind)
struct i2c_client *client; struct i2c_client *client;
dprintk("In tda9875_attach\n"); dprintk("In tda9875_attach\n");
t = kmalloc(sizeof *t,GFP_KERNEL); t = kzalloc(sizeof *t,GFP_KERNEL);
if (!t) if (!t)
return -ENOMEM; return -ENOMEM;
memset(t,0,sizeof *t);
client = &t->c; client = &t->c;
memcpy(client,&client_template,sizeof(struct i2c_client)); memcpy(client,&client_template,sizeof(struct i2c_client));
......
...@@ -696,9 +696,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -696,9 +696,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap; client_template.adapter = adap;
client_template.addr = addr; client_template.addr = addr;
if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
memset(t,0,sizeof(*t));
t->client = client_template; t->client = client_template;
t->std = 0; t->std = 0;
......
...@@ -99,11 +99,10 @@ static int tea6420_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -99,11 +99,10 @@ static int tea6420_detect(struct i2c_adapter *adapter, int address, int kind)
} }
/* allocate memory for client structure */ /* allocate memory for client structure */
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (0 == client) { if (0 == client) {
return -ENOMEM; return -ENOMEM;
} }
memset(client, 0x0, sizeof(struct i2c_client));
/* fill client structure */ /* fill client structure */
memcpy(client, &client_template, sizeof(struct i2c_client)); memcpy(client, &client_template, sizeof(struct i2c_client));
......
...@@ -410,10 +410,9 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -410,10 +410,9 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap; client_template.adapter = adap;
client_template.addr = addr; client_template.addr = addr;
t = kmalloc(sizeof(struct tuner), GFP_KERNEL); t = kzalloc(sizeof(struct tuner), GFP_KERNEL);
if (NULL == t) if (NULL == t)
return -ENOMEM; return -ENOMEM;
memset(t, 0, sizeof(struct tuner));
memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
i2c_set_clientdata(&t->i2c, t); i2c_set_clientdata(&t->i2c, t);
t->type = UNSET; t->type = UNSET;
......
...@@ -1468,10 +1468,9 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -1468,10 +1468,9 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
struct CHIPSTATE *chip; struct CHIPSTATE *chip;
struct CHIPDESC *desc; struct CHIPDESC *desc;
chip = kmalloc(sizeof(*chip),GFP_KERNEL); chip = kzalloc(sizeof(*chip),GFP_KERNEL);
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
memset(chip,0,sizeof(*chip));
memcpy(&chip->c,&client_template,sizeof(struct i2c_client)); memcpy(&chip->c,&client_template,sizeof(struct i2c_client));
chip->c.adapter = adap; chip->c.adapter = adap;
chip->c.addr = addr; chip->c.addr = addr;
......
...@@ -719,8 +719,7 @@ tveeprom_command(struct i2c_client *client, ...@@ -719,8 +719,7 @@ tveeprom_command(struct i2c_client *client,
switch (cmd) { switch (cmd) {
case 0: case 0:
buf = kmalloc(256,GFP_KERNEL); buf = kzalloc(256,GFP_KERNEL);
memset(buf,0,256);
tveeprom_read(client,buf,256); tveeprom_read(client,buf,256);
tveeprom_hauppauge_analog(client, &eeprom,buf); tveeprom_hauppauge_analog(client, &eeprom,buf);
kfree(buf); kfree(buf);
...@@ -743,10 +742,9 @@ tveeprom_detect_client(struct i2c_adapter *adapter, ...@@ -743,10 +742,9 @@ tveeprom_detect_client(struct i2c_adapter *adapter,
{ {
struct i2c_client *client; struct i2c_client *client;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (NULL == client) if (NULL == client)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver_tveeprom; client->driver = &i2c_driver_tveeprom;
......
...@@ -1074,12 +1074,11 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter, ...@@ -1074,12 +1074,11 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
return -ENOMEM; return -ENOMEM;
memcpy(c, &client_template, sizeof(struct i2c_client)); 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) { if (core == 0) {
kfree(c); kfree(c);
return -ENOMEM; return -ENOMEM;
} }
memset(core, 0, sizeof(struct tvp5150));
i2c_set_clientdata(c, core); i2c_set_clientdata(c, core);
rv = i2c_attach_client(c); rv = i2c_attach_client(c);
......
...@@ -305,9 +305,8 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -305,9 +305,8 @@ v4l_compat_translate_ioctl(struct inode *inode,
{ {
struct video_capability *cap = arg; struct video_capability *cap = arg;
cap2 = kmalloc(sizeof(*cap2),GFP_KERNEL); cap2 = kzalloc(sizeof(*cap2),GFP_KERNEL);
memset(cap, 0, sizeof(*cap)); memset(cap, 0, sizeof(*cap));
memset(cap2, 0, sizeof(*cap2));
memset(&fbuf2, 0, sizeof(fbuf2)); memset(&fbuf2, 0, sizeof(fbuf2));
err = drv(inode, file, VIDIOC_QUERYCAP, cap2); err = drv(inode, file, VIDIOC_QUERYCAP, cap2);
...@@ -422,9 +421,8 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -422,9 +421,8 @@ v4l_compat_translate_ioctl(struct inode *inode,
{ {
struct video_window *win = arg; struct video_window *win = arg;
fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
memset(win,0,sizeof(*win)); memset(win,0,sizeof(*win));
memset(fmt2,0,sizeof(*fmt2));
fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
err = drv(inode, file, VIDIOC_G_FMT, fmt2); err = drv(inode, file, VIDIOC_G_FMT, fmt2);
...@@ -461,8 +459,7 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -461,8 +459,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
struct video_window *win = arg; struct video_window *win = arg;
int err1,err2; int err1,err2;
fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
memset(fmt2,0,sizeof(*fmt2));
fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type);
err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); err1 = drv(inode, file, VIDIOC_G_FMT, fmt2);
...@@ -595,8 +592,7 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -595,8 +592,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
pict->whiteness = get_v4l_control(inode, file, pict->whiteness = get_v4l_control(inode, file,
V4L2_CID_WHITENESS, drv); V4L2_CID_WHITENESS, drv);
fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
memset(fmt2,0,sizeof(*fmt2));
fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
err = drv(inode, file, VIDIOC_G_FMT, fmt2); err = drv(inode, file, VIDIOC_G_FMT, fmt2);
if (err < 0) { if (err < 0) {
...@@ -622,8 +618,7 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -622,8 +618,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
set_v4l_control(inode, file, set_v4l_control(inode, file,
V4L2_CID_WHITENESS, pict->whiteness, drv); V4L2_CID_WHITENESS, pict->whiteness, drv);
fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
memset(fmt2,0,sizeof(*fmt2));
fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
err = drv(inode, file, VIDIOC_G_FMT, fmt2); err = drv(inode, file, VIDIOC_G_FMT, fmt2);
if (err < 0) if (err < 0)
...@@ -846,9 +841,8 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -846,9 +841,8 @@ v4l_compat_translate_ioctl(struct inode *inode,
{ {
struct video_mmap *mm = arg; struct video_mmap *mm = arg;
fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
memset(&buf2,0,sizeof(buf2)); memset(&buf2,0,sizeof(buf2));
memset(fmt2,0,sizeof(*fmt2));
fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
err = drv(inode, file, VIDIOC_G_FMT, fmt2); err = drv(inode, file, VIDIOC_G_FMT, fmt2);
...@@ -942,8 +936,7 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -942,8 +936,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
{ {
struct vbi_format *fmt = arg; struct vbi_format *fmt = arg;
fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
memset(fmt2, 0, sizeof(*fmt2));
fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;
err = drv(inode, file, VIDIOC_G_FMT, fmt2); err = drv(inode, file, VIDIOC_G_FMT, fmt2);
...@@ -975,8 +968,7 @@ v4l_compat_translate_ioctl(struct inode *inode, ...@@ -975,8 +968,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
break; break;
} }
fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
memset(fmt2, 0, sizeof(*fmt2));
fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;
fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line;
......
...@@ -52,10 +52,9 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) ...@@ -52,10 +52,9 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages)
struct page *pg; struct page *pg;
int i; int i;
sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
if (NULL == sglist) if (NULL == sglist)
return NULL; return NULL;
memset(sglist,0,sizeof(struct scatterlist)*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);
if (NULL == pg) if (NULL == pg)
...@@ -80,10 +79,9 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) ...@@ -80,10 +79,9 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
if (NULL == pages[0]) if (NULL == pages[0])
return NULL; return NULL;
sglist = kmalloc(sizeof(*sglist) * nr_pages, GFP_KERNEL); sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL);
if (NULL == sglist) if (NULL == sglist)
return NULL; return NULL;
memset(sglist, 0, sizeof(*sglist) * nr_pages);
if (NULL == pages[0]) if (NULL == pages[0])
goto nopage; goto nopage;
...@@ -284,9 +282,8 @@ void* videobuf_alloc(unsigned int size) ...@@ -284,9 +282,8 @@ void* videobuf_alloc(unsigned int size)
{ {
struct videobuf_buffer *vb; struct videobuf_buffer *vb;
vb = kmalloc(size,GFP_KERNEL); vb = kzalloc(size,GFP_KERNEL);
if (NULL != vb) { if (NULL != vb) {
memset(vb,0,size);
videobuf_dma_init(&vb->dma); videobuf_dma_init(&vb->dma);
init_waitqueue_head(&vb->done); init_waitqueue_head(&vb->done);
vb->magic = MAGIC_BUFFER; vb->magic = MAGIC_BUFFER;
......
...@@ -124,17 +124,13 @@ videocodec_attach (struct videocodec_master *master) ...@@ -124,17 +124,13 @@ videocodec_attach (struct videocodec_master *master)
if (res == 0) { if (res == 0) {
dprintk(3, "videocodec_attach '%s'\n", dprintk(3, "videocodec_attach '%s'\n",
codec->name); codec->name);
ptr = (struct attached_list *) ptr = kzalloc(sizeof(struct attached_list), GFP_KERNEL);
kmalloc(sizeof(struct attached_list),
GFP_KERNEL);
if (!ptr) { if (!ptr) {
dprintk(1, dprintk(1,
KERN_ERR KERN_ERR
"videocodec_attach: no memory\n"); "videocodec_attach: no memory\n");
goto out_kfree; goto out_kfree;
} }
memset(ptr, 0,
sizeof(struct attached_list));
ptr->codec = codec; ptr->codec = codec;
a = h->list; a = h->list;
...@@ -249,14 +245,11 @@ videocodec_register (const struct videocodec *codec) ...@@ -249,14 +245,11 @@ videocodec_register (const struct videocodec *codec)
"videocodec: register '%s', type: %x, flags %lx, magic %lx\n", "videocodec: register '%s', type: %x, flags %lx, magic %lx\n",
codec->name, codec->type, codec->flags, codec->magic); codec->name, codec->type, codec->flags, codec->magic);
ptr = ptr = kzalloc(sizeof(struct codec_list), GFP_KERNEL);
(struct codec_list *) kmalloc(sizeof(struct codec_list),
GFP_KERNEL);
if (!ptr) { if (!ptr) {
dprintk(1, KERN_ERR "videocodec_register: no memory\n"); dprintk(1, KERN_ERR "videocodec_register: no memory\n");
return -ENOMEM; return -ENOMEM;
} }
memset(ptr, 0, sizeof(struct codec_list));
ptr->codec = codec; ptr->codec = codec;
if (!h) { if (!h) {
......
...@@ -52,10 +52,7 @@ struct video_device *video_device_alloc(void) ...@@ -52,10 +52,7 @@ struct video_device *video_device_alloc(void)
{ {
struct video_device *vfd; struct video_device *vfd;
vfd = kmalloc(sizeof(*vfd),GFP_KERNEL); vfd = kzalloc(sizeof(*vfd),GFP_KERNEL);
if (NULL == vfd)
return NULL;
memset(vfd,0,sizeof(*vfd));
return vfd; return vfd;
} }
......
...@@ -4499,13 +4499,11 @@ static int vino_init(void) ...@@ -4499,13 +4499,11 @@ static int vino_init(void)
dma_addr_t dma_dummy_address; dma_addr_t dma_dummy_address;
int i; int i;
vino_drvdata = (struct vino_settings *) vino_drvdata = kzalloc(sizeof(struct vino_settings), GFP_KERNEL);
kmalloc(sizeof(struct vino_settings), GFP_KERNEL);
if (!vino_drvdata) { if (!vino_drvdata) {
vino_module_cleanup(vino_init_stage); vino_module_cleanup(vino_init_stage);
return -ENOMEM; return -ENOMEM;
} }
memset(vino_drvdata, 0, sizeof(struct vino_settings));
vino_init_stage++; vino_init_stage++;
/* create a dummy dma descriptor */ /* create a dummy dma descriptor */
......
...@@ -621,13 +621,11 @@ vpx3220_detect_client (struct i2c_adapter *adapter, ...@@ -621,13 +621,11 @@ vpx3220_detect_client (struct i2c_adapter *adapter,
(adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) (adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == NULL) { if (client == NULL) {
return -ENOMEM; return -ENOMEM;
} }
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &vpx3220_i2c_driver; client->driver = &vpx3220_i2c_driver;
...@@ -675,12 +673,11 @@ vpx3220_detect_client (struct i2c_adapter *adapter, ...@@ -675,12 +673,11 @@ vpx3220_detect_client (struct i2c_adapter *adapter,
sizeof(I2C_NAME(client))); sizeof(I2C_NAME(client)));
} }
decoder = kmalloc(sizeof(struct vpx3220), GFP_KERNEL); decoder = kzalloc(sizeof(struct vpx3220), GFP_KERNEL);
if (decoder == NULL) { if (decoder == NULL) {
kfree(client); kfree(client);
return -ENOMEM; return -ENOMEM;
} }
memset(decoder, 0, sizeof(struct vpx3220));
decoder->norm = VIDEO_MODE_PAL; decoder->norm = VIDEO_MODE_PAL;
decoder->input = 0; decoder->input = 0;
decoder->enable = 1; decoder->enable = 1;
......
...@@ -166,11 +166,10 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -166,11 +166,10 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind)
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return 0; return 0;
client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (client == 0) if (client == 0)
return -ENOMEM; return -ENOMEM;
memset(client, 0, sizeof(struct i2c_client));
client->addr = address; client->addr = address;
client->adapter = adapter; client->adapter = adapter;
client->driver = &i2c_driver; client->driver = &i2c_driver;
......
...@@ -1050,7 +1050,7 @@ zr36057_init (struct zoran *zr) ...@@ -1050,7 +1050,7 @@ zr36057_init (struct zoran *zr)
/* allocate memory *before* doing anything to the hardware /* allocate memory *before* doing anything to the hardware
* in case allocation fails */ * in case allocation fails */
mem_needed = BUZ_NUM_STAT_COM * 4; mem_needed = BUZ_NUM_STAT_COM * 4;
mem = (unsigned long) kmalloc(mem_needed, GFP_KERNEL); mem = kzalloc(mem_needed, GFP_KERNEL);
vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL); vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL);
if (!mem || !vdev) { if (!mem || !vdev) {
dprintk(1, dprintk(1,
...@@ -1061,7 +1061,6 @@ zr36057_init (struct zoran *zr) ...@@ -1061,7 +1061,6 @@ zr36057_init (struct zoran *zr)
kfree((void *)mem); kfree((void *)mem);
return -ENOMEM; return -ENOMEM;
} }
memset((void *) mem, 0, mem_needed);
zr->stat_com = (u32 *) mem; zr->stat_com = (u32 *) mem;
for (j = 0; j < BUZ_NUM_STAT_COM; j++) { for (j = 0; j < BUZ_NUM_STAT_COM; j++) {
zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */ zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */
......
...@@ -1345,7 +1345,7 @@ zoran_open (struct inode *inode, ...@@ -1345,7 +1345,7 @@ zoran_open (struct inode *inode,
ZR_DEVNAME(zr), current->comm, current->pid, zr->user); ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
/* now, create the open()-specific file_ops struct */ /* now, create the open()-specific file_ops struct */
fh = kmalloc(sizeof(struct zoran_fh), GFP_KERNEL); fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL);
if (!fh) { if (!fh) {
dprintk(1, dprintk(1,
KERN_ERR KERN_ERR
...@@ -1354,7 +1354,6 @@ zoran_open (struct inode *inode, ...@@ -1354,7 +1354,6 @@ zoran_open (struct inode *inode,
res = -ENOMEM; res = -ENOMEM;
goto open_unlock_and_return; goto open_unlock_and_return;
} }
memset(fh, 0, sizeof(struct zoran_fh));
/* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows /* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows
* on norm-change! */ * on norm-change! */
fh->overlay_mask = fh->overlay_mask =
......
...@@ -451,12 +451,11 @@ zr36016_setup (struct videocodec *codec) ...@@ -451,12 +451,11 @@ zr36016_setup (struct videocodec *codec)
return -ENOSPC; return -ENOSPC;
} }
//mem structure init //mem structure init
codec->data = ptr = kmalloc(sizeof(struct zr36016), GFP_KERNEL); codec->data = ptr = kzalloc(sizeof(struct zr36016), GFP_KERNEL);
if (NULL == ptr) { if (NULL == ptr) {
dprintk(1, KERN_ERR "zr36016: Can't get enough memory!\n"); dprintk(1, KERN_ERR "zr36016: Can't get enough memory!\n");
return -ENOMEM; return -ENOMEM;
} }
memset(ptr, 0, sizeof(struct zr36016));
snprintf(ptr->name, sizeof(ptr->name), "zr36016[%d]", snprintf(ptr->name, sizeof(ptr->name), "zr36016[%d]",
zr36016_codecs); zr36016_codecs);
......
...@@ -813,12 +813,11 @@ zr36050_setup (struct videocodec *codec) ...@@ -813,12 +813,11 @@ zr36050_setup (struct videocodec *codec)
return -ENOSPC; return -ENOSPC;
} }
//mem structure init //mem structure init
codec->data = ptr = kmalloc(sizeof(struct zr36050), GFP_KERNEL); codec->data = ptr = kzalloc(sizeof(struct zr36050), GFP_KERNEL);
if (NULL == ptr) { if (NULL == ptr) {
dprintk(1, KERN_ERR "zr36050: Can't get enough memory!\n"); dprintk(1, KERN_ERR "zr36050: Can't get enough memory!\n");
return -ENOMEM; return -ENOMEM;
} }
memset(ptr, 0, sizeof(struct zr36050));
snprintf(ptr->name, sizeof(ptr->name), "zr36050[%d]", snprintf(ptr->name, sizeof(ptr->name), "zr36050[%d]",
zr36050_codecs); zr36050_codecs);
......
...@@ -919,12 +919,11 @@ zr36060_setup (struct videocodec *codec) ...@@ -919,12 +919,11 @@ zr36060_setup (struct videocodec *codec)
return -ENOSPC; return -ENOSPC;
} }
//mem structure init //mem structure init
codec->data = ptr = kmalloc(sizeof(struct zr36060), GFP_KERNEL); codec->data = ptr = kzalloc(sizeof(struct zr36060), GFP_KERNEL);
if (NULL == ptr) { if (NULL == ptr) {
dprintk(1, KERN_ERR "zr36060: Can't get enough memory!\n"); dprintk(1, KERN_ERR "zr36060: Can't get enough memory!\n");
return -ENOMEM; return -ENOMEM;
} }
memset(ptr, 0, sizeof(struct zr36060));
snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]", snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]",
zr36060_codecs); zr36060_codecs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册