diff options
author | Panagiotis Issaris <takis@issaris.org> | 2006-01-11 16:40:56 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-11 16:40:56 -0500 |
commit | 7408187d223f63d46a13b6a35b8f96b032c2f623 (patch) | |
tree | 425a459f760295de488f57e3f97b034aaa76a78d | |
parent | 0b3af1b6df82cfdb54ae294ed860263011fa0408 (diff) |
V4L/DVB (3344a): Conversions from kmalloc+memset to k(z|c)alloc
Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
82 files changed, 118 insertions, 254 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 2899d34e5f7e..04c1938b9c91 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -109,10 +109,9 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) | |||
109 | struct page *pg; | 109 | struct page *pg; |
110 | int i; | 110 | int i; |
111 | 111 | ||
112 | sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); | 112 | sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); |
113 | if (NULL == sglist) | 113 | if (NULL == sglist) |
114 | return NULL; | 114 | return NULL; |
115 | memset(sglist,0,sizeof(struct scatterlist)*nr_pages); | ||
116 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { | 115 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { |
117 | pg = vmalloc_to_page(virt); | 116 | pg = vmalloc_to_page(virt); |
118 | if (NULL == pg) | 117 | if (NULL == pg) |
@@ -306,15 +305,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
306 | struct saa7146_dev *dev; | 305 | struct saa7146_dev *dev; |
307 | int err = -ENOMEM; | 306 | int err = -ENOMEM; |
308 | 307 | ||
309 | dev = kmalloc(sizeof(struct saa7146_dev), GFP_KERNEL); | 308 | /* clear out mem for sure */ |
309 | dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL); | ||
310 | if (!dev) { | 310 | if (!dev) { |
311 | ERR(("out of memory.\n")); | 311 | ERR(("out of memory.\n")); |
312 | goto out; | 312 | goto out; |
313 | } | 313 | } |
314 | 314 | ||
315 | /* clear out mem for sure */ | ||
316 | memset(dev, 0x0, sizeof(struct saa7146_dev)); | ||
317 | |||
318 | DEB_EE(("pci:%p\n",pci)); | 315 | DEB_EE(("pci:%p\n",pci)); |
319 | 316 | ||
320 | err = pci_enable_device(pci); | 317 | err = pci_enable_device(pci); |
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index b614612be7b4..f8cf73ed49ad 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -239,13 +239,12 @@ static int fops_open(struct inode *inode, struct file *file) | |||
239 | } | 239 | } |
240 | 240 | ||
241 | /* allocate per open data */ | 241 | /* allocate per open data */ |
242 | fh = kmalloc(sizeof(*fh),GFP_KERNEL); | 242 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
243 | if (NULL == fh) { | 243 | if (NULL == fh) { |
244 | DEB_S(("cannot allocate memory for per open data.\n")); | 244 | DEB_S(("cannot allocate memory for per open data.\n")); |
245 | result = -ENOMEM; | 245 | result = -ENOMEM; |
246 | goto out; | 246 | goto out; |
247 | } | 247 | } |
248 | memset(fh,0,sizeof(*fh)); | ||
249 | 248 | ||
250 | file->private_data = fh; | 249 | file->private_data = fh; |
251 | fh->dev = dev; | 250 | fh->dev = dev; |
@@ -464,12 +463,11 @@ static struct video_device device_template = | |||
464 | 463 | ||
465 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) | 464 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) |
466 | { | 465 | { |
467 | struct saa7146_vv *vv = kmalloc (sizeof(struct saa7146_vv),GFP_KERNEL); | 466 | struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL); |
468 | if( NULL == vv ) { | 467 | if( NULL == vv ) { |
469 | ERR(("out of memory. aborting.\n")); | 468 | ERR(("out of memory. aborting.\n")); |
470 | return -1; | 469 | return -1; |
471 | } | 470 | } |
472 | memset(vv, 0x0, sizeof(*vv)); | ||
473 | 471 | ||
474 | DEB_EE(("dev:%p\n",dev)); | 472 | DEB_EE(("dev:%p\n",dev)); |
475 | 473 | ||
diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c index 123ed96f6faa..56ba52470676 100644 --- a/drivers/media/dvb/b2c2/flexcop.c +++ b/drivers/media/dvb/b2c2/flexcop.c | |||
@@ -220,20 +220,18 @@ EXPORT_SYMBOL(flexcop_reset_block_300); | |||
220 | struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) | 220 | struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) |
221 | { | 221 | { |
222 | void *bus; | 222 | void *bus; |
223 | struct flexcop_device *fc = kmalloc(sizeof(struct flexcop_device), GFP_KERNEL); | 223 | struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), GFP_KERNEL); |
224 | if (!fc) { | 224 | if (!fc) { |
225 | err("no memory"); | 225 | err("no memory"); |
226 | return NULL; | 226 | return NULL; |
227 | } | 227 | } |
228 | memset(fc, 0, sizeof(struct flexcop_device)); | ||
229 | 228 | ||
230 | bus = kmalloc(bus_specific_len, GFP_KERNEL); | 229 | bus = kzalloc(bus_specific_len, GFP_KERNEL); |
231 | if (!bus) { | 230 | if (!bus) { |
232 | err("no memory"); | 231 | err("no memory"); |
233 | kfree(fc); | 232 | kfree(fc); |
234 | return NULL; | 233 | return NULL; |
235 | } | 234 | } |
236 | memset(bus, 0, bus_specific_len); | ||
237 | 235 | ||
238 | fc->bus_specific = bus; | 236 | fc->bus_specific = bus; |
239 | 237 | ||
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 01b4e0aac049..f65f64b00ff3 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c | |||
@@ -786,10 +786,9 @@ static int dvb_bt8xx_probe(struct device *dev) | |||
786 | struct pci_dev* bttv_pci_dev; | 786 | struct pci_dev* bttv_pci_dev; |
787 | int ret; | 787 | int ret; |
788 | 788 | ||
789 | if (!(card = kmalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) | 789 | if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) |
790 | return -ENOMEM; | 790 | return -ENOMEM; |
791 | 791 | ||
792 | memset(card, 0, sizeof(*card)); | ||
793 | init_MUTEX(&card->lock); | 792 | init_MUTEX(&card->lock); |
794 | card->bttv_nr = sub->core->nr; | 793 | card->bttv_nr = sub->core->nr; |
795 | strncpy(card->card_name, sub->core->name, sizeof(sub->core->name)); | 794 | strncpy(card->card_name, sub->core->name, sizeof(sub->core->name)); |
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 4bb779aeff6a..00347a750681 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | |||
@@ -1649,21 +1649,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, | |||
1649 | return -EINVAL; | 1649 | return -EINVAL; |
1650 | 1650 | ||
1651 | /* initialise the system data */ | 1651 | /* initialise the system data */ |
1652 | if ((ca = | 1652 | if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) { |
1653 | (struct dvb_ca_private *) kmalloc(sizeof(struct dvb_ca_private), | ||
1654 | GFP_KERNEL)) == NULL) { | ||
1655 | ret = -ENOMEM; | 1653 | ret = -ENOMEM; |
1656 | goto error; | 1654 | goto error; |
1657 | } | 1655 | } |
1658 | memset(ca, 0, sizeof(struct dvb_ca_private)); | ||
1659 | ca->pub = pubca; | 1656 | ca->pub = pubca; |
1660 | ca->flags = flags; | 1657 | ca->flags = flags; |
1661 | ca->slot_count = slot_count; | 1658 | ca->slot_count = slot_count; |
1662 | if ((ca->slot_info = kmalloc(sizeof(struct dvb_ca_slot) * slot_count, GFP_KERNEL)) == NULL) { | 1659 | if ((ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), GFP_KERNEL)) == NULL) { |
1663 | ret = -ENOMEM; | 1660 | ret = -ENOMEM; |
1664 | goto error; | 1661 | goto error; |
1665 | } | 1662 | } |
1666 | memset(ca->slot_info, 0, sizeof(struct dvb_ca_slot) * slot_count); | ||
1667 | init_waitqueue_head(&ca->wait_queue); | 1663 | init_waitqueue_head(&ca->wait_queue); |
1668 | ca->thread_pid = 0; | 1664 | ca->thread_pid = 0; |
1669 | init_waitqueue_head(&ca->thread_queue); | 1665 | init_waitqueue_head(&ca->thread_queue); |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4a08c4ab6730..771f32d889e6 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -1024,13 +1024,12 @@ int dvb_register_frontend(struct dvb_adapter* dvb, | |||
1024 | if (down_interruptible (&frontend_mutex)) | 1024 | if (down_interruptible (&frontend_mutex)) |
1025 | return -ERESTARTSYS; | 1025 | return -ERESTARTSYS; |
1026 | 1026 | ||
1027 | fe->frontend_priv = kmalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); | 1027 | fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); |
1028 | if (fe->frontend_priv == NULL) { | 1028 | if (fe->frontend_priv == NULL) { |
1029 | up(&frontend_mutex); | 1029 | up(&frontend_mutex); |
1030 | return -ENOMEM; | 1030 | return -ENOMEM; |
1031 | } | 1031 | } |
1032 | fepriv = fe->frontend_priv; | 1032 | fepriv = fe->frontend_priv; |
1033 | memset(fe->frontend_priv, 0, sizeof(struct dvb_frontend_private)); | ||
1034 | 1033 | ||
1035 | init_MUTEX (&fepriv->sem); | 1034 | init_MUTEX (&fepriv->sem); |
1036 | init_waitqueue_head (&fepriv->wait_queue); | 1035 | init_waitqueue_head (&fepriv->wait_queue); |
diff --git a/drivers/media/dvb/dvb-usb/dtt200u-fe.c b/drivers/media/dvb/dvb-usb/dtt200u-fe.c index 0a94ec22aeb8..cd21ddbfd054 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/dvb/dvb-usb/dtt200u-fe.c | |||
@@ -156,10 +156,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) | |||
156 | struct dtt200u_fe_state* state = NULL; | 156 | struct dtt200u_fe_state* state = NULL; |
157 | 157 | ||
158 | /* allocate memory for the internal state */ | 158 | /* allocate memory for the internal state */ |
159 | state = (struct dtt200u_fe_state*) kmalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); | 159 | state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); |
160 | if (state == NULL) | 160 | if (state == NULL) |
161 | goto error; | 161 | goto error; |
162 | memset(state,0,sizeof(struct dtt200u_fe_state)); | ||
163 | 162 | ||
164 | deb_info("attaching frontend dtt200u\n"); | 163 | deb_info("attaching frontend dtt200u\n"); |
165 | 164 | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 2e23060cbbca..716f8bf528cd 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/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 | |||
154 | } | 154 | } |
155 | 155 | ||
156 | info("found a '%s' in warm state.",desc->name); | 156 | info("found a '%s' in warm state.",desc->name); |
157 | d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); | 157 | d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); |
158 | if (d == NULL) { | 158 | if (d == NULL) { |
159 | err("no memory for 'struct dvb_usb_device'"); | 159 | err("no memory for 'struct dvb_usb_device'"); |
160 | return ret; | 160 | return ret; |
161 | } | 161 | } |
162 | memset(d,0,sizeof(struct dvb_usb_device)); | ||
163 | 162 | ||
164 | d->udev = udev; | 163 | d->udev = udev; |
165 | memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); | 164 | 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 | d->owner = owner; | 166 | d->owner = owner; |
168 | 167 | ||
169 | if (d->props.size_of_priv > 0) { | 168 | if (d->props.size_of_priv > 0) { |
170 | d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); | 169 | d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL); |
171 | if (d->priv == NULL) { | 170 | if (d->priv == NULL) { |
172 | err("no memory for priv in 'struct dvb_usb_device'"); | 171 | err("no memory for priv in 'struct dvb_usb_device'"); |
173 | kfree(d); | 172 | kfree(d); |
174 | return -ENOMEM; | 173 | return -ENOMEM; |
175 | } | 174 | } |
176 | memset(d->priv,0,d->props.size_of_priv); | ||
177 | } | 175 | } |
178 | 176 | ||
179 | usb_set_intfdata(intf, d); | 177 | usb_set_intfdata(intf, d); |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index 36b7048c02d2..ee821974dc60 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/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 | |||
175 | 175 | ||
176 | deb_mem("all in all I will use %lu bytes for streaming\n",num*size); | 176 | deb_mem("all in all I will use %lu bytes for streaming\n",num*size); |
177 | 177 | ||
178 | if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL) | 178 | if ((d->buf_list = kcalloc(num, sizeof(u8 *), GFP_ATOMIC)) == NULL) |
179 | return -ENOMEM; | 179 | return -ENOMEM; |
180 | 180 | ||
181 | if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { | 181 | if ((d->dma_addr = kcalloc(num, sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { |
182 | kfree(d->buf_list); | 182 | kfree(d->buf_list); |
183 | return -ENOMEM; | 183 | return -ENOMEM; |
184 | } | 184 | } |
185 | memset(d->buf_list,0,num*sizeof(u8 *)); | ||
186 | memset(d->dma_addr,0,num*sizeof(dma_addr_t)); | ||
187 | 185 | ||
188 | d->state |= DVB_USB_STATE_URB_BUF; | 186 | d->state |= DVB_USB_STATE_URB_BUF; |
189 | 187 | ||
@@ -285,10 +283,9 @@ int dvb_usb_urb_init(struct dvb_usb_device *d) | |||
285 | usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint)); | 283 | usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint)); |
286 | 284 | ||
287 | /* allocate the array for the data transfer URBs */ | 285 | /* allocate the array for the data transfer URBs */ |
288 | d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); | 286 | d->urb_list = kzalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); |
289 | if (d->urb_list == NULL) | 287 | if (d->urb_list == NULL) |
290 | return -ENOMEM; | 288 | return -ENOMEM; |
291 | memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *)); | ||
292 | d->state |= DVB_USB_STATE_URB_LIST; | 289 | d->state |= DVB_USB_STATE_URB_LIST; |
293 | 290 | ||
294 | switch (d->props.urb.type) { | 291 | switch (d->props.urb.type) { |
diff --git a/drivers/media/dvb/dvb-usb/vp702x-fe.c b/drivers/media/dvb/dvb-usb/vp702x-fe.c index 0885d9fb2bf2..b6d95e1c9c52 100644 --- a/drivers/media/dvb/dvb-usb/vp702x-fe.c +++ b/drivers/media/dvb/dvb-usb/vp702x-fe.c | |||
@@ -281,10 +281,9 @@ static struct dvb_frontend_ops vp702x_fe_ops; | |||
281 | 281 | ||
282 | struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) | 282 | struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) |
283 | { | 283 | { |
284 | struct vp702x_fe_state *s = kmalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); | 284 | struct vp702x_fe_state *s = kzalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); |
285 | if (s == NULL) | 285 | if (s == NULL) |
286 | goto error; | 286 | goto error; |
287 | memset(s,0,sizeof(struct vp702x_fe_state)); | ||
288 | 287 | ||
289 | s->d = d; | 288 | s->d = d; |
290 | s->fe.ops = &vp702x_fe_ops; | 289 | s->fe.ops = &vp702x_fe_ops; |
diff --git a/drivers/media/dvb/dvb-usb/vp7045-fe.c b/drivers/media/dvb/dvb-usb/vp7045-fe.c index 83f1de1e7e57..5242cca5db4a 100644 --- a/drivers/media/dvb/dvb-usb/vp7045-fe.c +++ b/drivers/media/dvb/dvb-usb/vp7045-fe.c | |||
@@ -145,10 +145,9 @@ static struct dvb_frontend_ops vp7045_fe_ops; | |||
145 | 145 | ||
146 | struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) | 146 | struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) |
147 | { | 147 | { |
148 | struct vp7045_fe_state *s = kmalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); | 148 | struct vp7045_fe_state *s = kzalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); |
149 | if (s == NULL) | 149 | if (s == NULL) |
150 | goto error; | 150 | goto error; |
151 | memset(s,0,sizeof(struct vp7045_fe_state)); | ||
152 | 151 | ||
153 | s->d = d; | 152 | s->d = d; |
154 | s->fe.ops = &vp7045_fe_ops; | 153 | s->fe.ops = &vp7045_fe_ops; |
diff --git a/drivers/media/dvb/frontends/bcm3510.c b/drivers/media/dvb/frontends/bcm3510.c index 3b132bafd4de..caaee893ca76 100644 --- a/drivers/media/dvb/frontends/bcm3510.c +++ b/drivers/media/dvb/frontends/bcm3510.c | |||
@@ -782,10 +782,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, | |||
782 | bcm3510_register_value v; | 782 | bcm3510_register_value v; |
783 | 783 | ||
784 | /* allocate memory for the internal state */ | 784 | /* allocate memory for the internal state */ |
785 | state = kmalloc(sizeof(struct bcm3510_state), GFP_KERNEL); | 785 | state = kzalloc(sizeof(struct bcm3510_state), GFP_KERNEL); |
786 | if (state == NULL) | 786 | if (state == NULL) |
787 | goto error; | 787 | goto error; |
788 | memset(state,0,sizeof(struct bcm3510_state)); | ||
789 | 788 | ||
790 | /* setup the state */ | 789 | /* setup the state */ |
791 | 790 | ||
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index 6b0553608610..ae589adb1c0a 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
@@ -700,10 +700,9 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, | |||
700 | struct dib3000_state* state = NULL; | 700 | struct dib3000_state* state = NULL; |
701 | 701 | ||
702 | /* allocate memory for the internal state */ | 702 | /* allocate memory for the internal state */ |
703 | state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); | 703 | state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); |
704 | if (state == NULL) | 704 | if (state == NULL) |
705 | goto error; | 705 | goto error; |
706 | memset(state,0,sizeof(struct dib3000_state)); | ||
707 | 706 | ||
708 | /* setup the state */ | 707 | /* setup the state */ |
709 | state->i2c = i2c; | 708 | state->i2c = i2c; |
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index c024fad17337..3b303dbb6156 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -832,10 +832,9 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, | |||
832 | u16 devid; | 832 | u16 devid; |
833 | 833 | ||
834 | /* allocate memory for the internal state */ | 834 | /* allocate memory for the internal state */ |
835 | state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); | 835 | state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); |
836 | if (state == NULL) | 836 | if (state == NULL) |
837 | goto error; | 837 | goto error; |
838 | memset(state,0,sizeof(struct dib3000_state)); | ||
839 | 838 | ||
840 | /* setup the state */ | 839 | /* setup the state */ |
841 | state->i2c = i2c; | 840 | state->i2c = i2c; |
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index 9d214643b87a..4691ac54bc1d 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c | |||
@@ -714,10 +714,9 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, | |||
714 | u8 buf[1]; | 714 | u8 buf[1]; |
715 | 715 | ||
716 | /* Allocate memory for the internal state */ | 716 | /* Allocate memory for the internal state */ |
717 | state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); | 717 | state = kzalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); |
718 | if (state == NULL) | 718 | if (state == NULL) |
719 | goto error; | 719 | goto error; |
720 | memset(state,0,sizeof(*state)); | ||
721 | 720 | ||
722 | /* Setup the state */ | 721 | /* Setup the state */ |
723 | state->config = config; | 722 | state->config = config; |
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c index f0c610f2c2df..aaaec909ddf8 100644 --- a/drivers/media/dvb/frontends/mt352.c +++ b/drivers/media/dvb/frontends/mt352.c | |||
@@ -535,9 +535,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, | |||
535 | struct mt352_state* state = NULL; | 535 | struct mt352_state* state = NULL; |
536 | 536 | ||
537 | /* allocate memory for the internal state */ | 537 | /* allocate memory for the internal state */ |
538 | state = kmalloc(sizeof(struct mt352_state), GFP_KERNEL); | 538 | state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL); |
539 | if (state == NULL) goto error; | 539 | if (state == NULL) goto error; |
540 | memset(state,0,sizeof(*state)); | ||
541 | 540 | ||
542 | /* setup the state */ | 541 | /* setup the state */ |
543 | state->i2c = i2c; | 542 | state->i2c = i2c; |
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index aeafef46e3eb..78d2b93d35b9 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c | |||
@@ -1110,10 +1110,9 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, | |||
1110 | u8 buf [] = {0,0,0,0,0}; | 1110 | u8 buf [] = {0,0,0,0,0}; |
1111 | 1111 | ||
1112 | /* allocate memory for the internal state */ | 1112 | /* allocate memory for the internal state */ |
1113 | state = (struct nxt200x_state*) kmalloc(sizeof(struct nxt200x_state), GFP_KERNEL); | 1113 | state = kzalloc(sizeof(struct nxt200x_state), GFP_KERNEL); |
1114 | if (state == NULL) | 1114 | if (state == NULL) |
1115 | goto error; | 1115 | goto error; |
1116 | memset(state,0,sizeof(*state)); | ||
1117 | 1116 | ||
1118 | /* setup the state */ | 1117 | /* setup the state */ |
1119 | state->config = config; | 1118 | state->config = config; |
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index bbebd1c4caca..1c5316e209ef 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c | |||
@@ -584,11 +584,10 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, | |||
584 | struct dmx_demux *dmx; | 584 | struct dmx_demux *dmx; |
585 | int ret = -ENOMEM; | 585 | int ret = -ENOMEM; |
586 | 586 | ||
587 | pluto = kmalloc(sizeof(struct pluto), GFP_KERNEL); | 587 | pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL); |
588 | if (!pluto) | 588 | if (!pluto) |
589 | goto out; | 589 | goto out; |
590 | 590 | ||
591 | memset(pluto, 0, sizeof(struct pluto)); | ||
592 | pluto->pdev = pdev; | 591 | pluto->pdev = pdev; |
593 | 592 | ||
594 | ret = pci_enable_device(pdev); | 593 | ret = pci_enable_device(pdev); |
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 8ce4146f55f1..327a8089193b 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -2565,14 +2565,12 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d | |||
2565 | } | 2565 | } |
2566 | 2566 | ||
2567 | /* prepare the av7110 device struct */ | 2567 | /* prepare the av7110 device struct */ |
2568 | av7110 = kmalloc(sizeof(struct av7110), GFP_KERNEL); | 2568 | av7110 = kzalloc(sizeof(struct av7110), GFP_KERNEL); |
2569 | if (!av7110) { | 2569 | if (!av7110) { |
2570 | dprintk(1, "out of memory\n"); | 2570 | dprintk(1, "out of memory\n"); |
2571 | return -ENOMEM; | 2571 | return -ENOMEM; |
2572 | } | 2572 | } |
2573 | 2573 | ||
2574 | memset(av7110, 0, sizeof(struct av7110)); | ||
2575 | |||
2576 | av7110->card_name = (char*) pci_ext->ext_priv; | 2574 | av7110->card_name = (char*) pci_ext->ext_priv; |
2577 | av7110->dev = dev; | 2575 | av7110->dev = dev; |
2578 | dev->ext_priv = av7110; | 2576 | dev->ext_priv = av7110; |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index f9d00452e639..aa2645895769 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -1027,11 +1027,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1027 | 1027 | ||
1028 | dprintk(2, "dev: %p\n", dev); | 1028 | dprintk(2, "dev: %p\n", dev); |
1029 | 1029 | ||
1030 | if (!(budget_av = kmalloc(sizeof(struct budget_av), GFP_KERNEL))) | 1030 | if (!(budget_av = kzalloc(sizeof(struct budget_av), GFP_KERNEL))) |
1031 | return -ENOMEM; | 1031 | return -ENOMEM; |
1032 | 1032 | ||
1033 | memset(budget_av, 0, sizeof(struct budget_av)); | ||
1034 | |||
1035 | budget_av->has_saa7113 = 0; | 1033 | budget_av->has_saa7113 = 0; |
1036 | budget_av->budget.ci_present = 0; | 1034 | budget_av->budget.ci_present = 0; |
1037 | 1035 | ||
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 104df610dbe1..5a13c4744f61 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/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 | |||
1489 | 1489 | ||
1490 | if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV; | 1490 | if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV; |
1491 | 1491 | ||
1492 | if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL))) | 1492 | if (!(ttusb = kzalloc(sizeof(struct ttusb), GFP_KERNEL))) |
1493 | return -ENOMEM; | 1493 | return -ENOMEM; |
1494 | 1494 | ||
1495 | memset(ttusb, 0, sizeof(struct ttusb)); | ||
1496 | |||
1497 | ttusb->dev = udev; | 1495 | ttusb->dev = udev; |
1498 | ttusb->c = 0; | 1496 | ttusb->c = 0; |
1499 | ttusb->mux_state = 0; | 1497 | ttusb->mux_state = 0; |
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index d8966d1d25ee..df831171e03c 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c | |||
@@ -1606,15 +1606,13 @@ static int ttusb_dec_probe(struct usb_interface *intf, | |||
1606 | 1606 | ||
1607 | udev = interface_to_usbdev(intf); | 1607 | udev = interface_to_usbdev(intf); |
1608 | 1608 | ||
1609 | if (!(dec = kmalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { | 1609 | if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { |
1610 | printk("%s: couldn't allocate memory.\n", __FUNCTION__); | 1610 | printk("%s: couldn't allocate memory.\n", __FUNCTION__); |
1611 | return -ENOMEM; | 1611 | return -ENOMEM; |
1612 | } | 1612 | } |
1613 | 1613 | ||
1614 | usb_set_intfdata(intf, (void *)dec); | 1614 | usb_set_intfdata(intf, (void *)dec); |
1615 | 1615 | ||
1616 | memset(dec, 0, sizeof(struct ttusb_dec)); | ||
1617 | |||
1618 | switch (le16_to_cpu(id->idProduct)) { | 1616 | switch (le16_to_cpu(id->idProduct)) { |
1619 | case 0x1006: | 1617 | case 0x1006: |
1620 | ttusb_dec_set_model(dec, TTUSB_DEC3000S); | 1618 | ttusb_dec_set_model(dec, TTUSB_DEC3000S); |
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 69ac8aa73eba..8e499b8f64c7 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
@@ -318,11 +318,10 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci | |||
318 | struct gemtek_pci_card *card; | 318 | struct gemtek_pci_card *card; |
319 | struct video_device *devradio; | 319 | struct video_device *devradio; |
320 | 320 | ||
321 | if ( (card = kmalloc( sizeof( struct gemtek_pci_card ), GFP_KERNEL )) == NULL ) { | 321 | if ( (card = kzalloc( sizeof( struct gemtek_pci_card ), GFP_KERNEL )) == NULL ) { |
322 | printk( KERN_ERR "gemtek_pci: out of memory\n" ); | 322 | printk( KERN_ERR "gemtek_pci: out of memory\n" ); |
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | } | 324 | } |
325 | memset( card, 0, sizeof( struct gemtek_pci_card ) ); | ||
326 | 325 | ||
327 | if ( pci_enable_device( pci_dev ) ) | 326 | if ( pci_enable_device( pci_dev ) ) |
328 | goto err_pci; | 327 | goto err_pci; |
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index e61003de1d5f..4ce07ae62dac 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
@@ -413,10 +413,9 @@ adv7170_detect_client (struct i2c_adapter *adapter, | |||
413 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 413 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
414 | return 0; | 414 | return 0; |
415 | 415 | ||
416 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 416 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
417 | if (client == 0) | 417 | if (client == 0) |
418 | return -ENOMEM; | 418 | return -ENOMEM; |
419 | memset(client, 0, sizeof(struct i2c_client)); | ||
420 | client->addr = address; | 419 | client->addr = address; |
421 | client->adapter = adapter; | 420 | client->adapter = adapter; |
422 | client->driver = &i2c_driver_adv7170; | 421 | client->driver = &i2c_driver_adv7170; |
@@ -433,12 +432,11 @@ adv7170_detect_client (struct i2c_adapter *adapter, | |||
433 | } | 432 | } |
434 | strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); | 433 | strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); |
435 | 434 | ||
436 | encoder = kmalloc(sizeof(struct adv7170), GFP_KERNEL); | 435 | encoder = kzalloc(sizeof(struct adv7170), GFP_KERNEL); |
437 | if (encoder == NULL) { | 436 | if (encoder == NULL) { |
438 | kfree(client); | 437 | kfree(client); |
439 | return -ENOMEM; | 438 | return -ENOMEM; |
440 | } | 439 | } |
441 | memset(encoder, 0, sizeof(struct adv7170)); | ||
442 | encoder->norm = VIDEO_MODE_NTSC; | 440 | encoder->norm = VIDEO_MODE_NTSC; |
443 | encoder->input = 0; | 441 | encoder->input = 0; |
444 | encoder->enable = 1; | 442 | encoder->enable = 1; |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 6d9536a71ee4..4e218f22b214 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
@@ -463,10 +463,9 @@ adv7175_detect_client (struct i2c_adapter *adapter, | |||
463 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 463 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
464 | return 0; | 464 | return 0; |
465 | 465 | ||
466 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 466 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
467 | if (client == 0) | 467 | if (client == 0) |
468 | return -ENOMEM; | 468 | return -ENOMEM; |
469 | memset(client, 0, sizeof(struct i2c_client)); | ||
470 | client->addr = address; | 469 | client->addr = address; |
471 | client->adapter = adapter; | 470 | client->adapter = adapter; |
472 | client->driver = &i2c_driver_adv7175; | 471 | client->driver = &i2c_driver_adv7175; |
@@ -483,12 +482,11 @@ adv7175_detect_client (struct i2c_adapter *adapter, | |||
483 | } | 482 | } |
484 | strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); | 483 | strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); |
485 | 484 | ||
486 | encoder = kmalloc(sizeof(struct adv7175), GFP_KERNEL); | 485 | encoder = kzalloc(sizeof(struct adv7175), GFP_KERNEL); |
487 | if (encoder == NULL) { | 486 | if (encoder == NULL) { |
488 | kfree(client); | 487 | kfree(client); |
489 | return -ENOMEM; | 488 | return -ENOMEM; |
490 | } | 489 | } |
491 | memset(encoder, 0, sizeof(struct adv7175)); | ||
492 | encoder->norm = VIDEO_MODE_PAL; | 490 | encoder->norm = VIDEO_MODE_PAL; |
493 | encoder->input = 0; | 491 | encoder->input = 0; |
494 | encoder->enable = 1; | 492 | encoder->enable = 1; |
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 560b99891753..d6447791d0e5 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
@@ -528,21 +528,18 @@ bt819_detect_client (struct i2c_adapter *adapter, | |||
528 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 528 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
529 | return 0; | 529 | return 0; |
530 | 530 | ||
531 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 531 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
532 | if (client == 0) | 532 | if (client == 0) |
533 | return -ENOMEM; | 533 | return -ENOMEM; |
534 | memset(client, 0, sizeof(struct i2c_client)); | ||
535 | client->addr = address; | 534 | client->addr = address; |
536 | client->adapter = adapter; | 535 | client->adapter = adapter; |
537 | client->driver = &i2c_driver_bt819; | 536 | client->driver = &i2c_driver_bt819; |
538 | 537 | ||
539 | decoder = kmalloc(sizeof(struct bt819), GFP_KERNEL); | 538 | decoder = kzalloc(sizeof(struct bt819), GFP_KERNEL); |
540 | if (decoder == NULL) { | 539 | if (decoder == NULL) { |
541 | kfree(client); | 540 | kfree(client); |
542 | return -ENOMEM; | 541 | return -ENOMEM; |
543 | } | 542 | } |
544 | |||
545 | memset(decoder, 0, sizeof(struct bt819)); | ||
546 | decoder->norm = VIDEO_MODE_NTSC; | 543 | decoder->norm = VIDEO_MODE_NTSC; |
547 | decoder->input = 0; | 544 | decoder->input = 0; |
548 | decoder->enable = 1; | 545 | decoder->enable = 1; |
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index dda4aa6bef27..361a9b6ccce3 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c | |||
@@ -167,9 +167,8 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, int kind) | |||
167 | client_template.adapter = adap; | 167 | client_template.adapter = adap; |
168 | client_template.addr = addr; | 168 | client_template.addr = addr; |
169 | 169 | ||
170 | if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) | 170 | if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL))) |
171 | return -ENOMEM; | 171 | return -ENOMEM; |
172 | memset(t,0,sizeof(*t)); | ||
173 | t->client = client_template; | 172 | t->client = client_template; |
174 | i2c_set_clientdata(&t->client, t); | 173 | i2c_set_clientdata(&t->client, t); |
175 | i2c_attach_client(&t->client); | 174 | i2c_attach_client(&t->client); |
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 60508069bbed..909b593530ed 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
@@ -316,21 +316,19 @@ bt856_detect_client (struct i2c_adapter *adapter, | |||
316 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 316 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
317 | return 0; | 317 | return 0; |
318 | 318 | ||
319 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 319 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
320 | if (client == 0) | 320 | if (client == 0) |
321 | return -ENOMEM; | 321 | return -ENOMEM; |
322 | memset(client, 0, sizeof(struct i2c_client)); | ||
323 | client->addr = address; | 322 | client->addr = address; |
324 | client->adapter = adapter; | 323 | client->adapter = adapter; |
325 | client->driver = &i2c_driver_bt856; | 324 | client->driver = &i2c_driver_bt856; |
326 | strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client))); | 325 | strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client))); |
327 | 326 | ||
328 | encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL); | 327 | encoder = kzalloc(sizeof(struct bt856), GFP_KERNEL); |
329 | if (encoder == NULL) { | 328 | if (encoder == NULL) { |
330 | kfree(client); | 329 | kfree(client); |
331 | return -ENOMEM; | 330 | return -ENOMEM; |
332 | } | 331 | } |
333 | memset(encoder, 0, sizeof(struct bt856)); | ||
334 | encoder->norm = VIDEO_MODE_NTSC; | 332 | encoder->norm = VIDEO_MODE_NTSC; |
335 | encoder->enable = 1; | 333 | encoder->enable = 1; |
336 | i2c_set_clientdata(client, encoder); | 334 | i2c_set_clientdata(client, encoder); |
diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c index 575ce8b8e714..d64accc17b0e 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bttv-gpio.c | |||
@@ -64,10 +64,9 @@ int bttv_sub_add_device(struct bttv_core *core, char *name) | |||
64 | struct bttv_sub_device *sub; | 64 | struct bttv_sub_device *sub; |
65 | int err; | 65 | int err; |
66 | 66 | ||
67 | sub = kmalloc(sizeof(*sub),GFP_KERNEL); | 67 | sub = kzalloc(sizeof(*sub),GFP_KERNEL); |
68 | if (NULL == sub) | 68 | if (NULL == sub) |
69 | return -ENOMEM; | 69 | return -ENOMEM; |
70 | memset(sub,0,sizeof(*sub)); | ||
71 | 70 | ||
72 | sub->core = core; | 71 | sub->core = core; |
73 | sub->dev.parent = &core->pci->dev; | 72 | sub->dev.parent = &core->pci->dev; |
diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c index 6861d408f1b3..74cff626e044 100644 --- a/drivers/media/video/cpia_pp.c +++ b/drivers/media/video/cpia_pp.c | |||
@@ -702,12 +702,11 @@ static int cpia_pp_register(struct parport *port) | |||
702 | return -ENXIO; | 702 | return -ENXIO; |
703 | } | 703 | } |
704 | 704 | ||
705 | cam = kmalloc(sizeof(struct pp_cam_entry), GFP_KERNEL); | 705 | cam = kzalloc(sizeof(struct pp_cam_entry), GFP_KERNEL); |
706 | if (cam == NULL) { | 706 | if (cam == NULL) { |
707 | LOG("failed to allocate camera structure\n"); | 707 | LOG("failed to allocate camera structure\n"); |
708 | return -ENOMEM; | 708 | return -ENOMEM; |
709 | } | 709 | } |
710 | memset(cam,0,sizeof(struct pp_cam_entry)); | ||
711 | 710 | ||
712 | pdev = parport_register_device(port, "cpia_pp", NULL, NULL, | 711 | pdev = parport_register_device(port, "cpia_pp", NULL, NULL, |
713 | NULL, 0, cam); | 712 | NULL, 0, cam); |
diff --git a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c index 1439cb752874..03275c37c5d3 100644 --- a/drivers/media/video/cpia_usb.c +++ b/drivers/media/video/cpia_usb.c | |||
@@ -499,14 +499,12 @@ static int cpia_probe(struct usb_interface *intf, | |||
499 | 499 | ||
500 | printk(KERN_INFO "USB CPiA camera found\n"); | 500 | printk(KERN_INFO "USB CPiA camera found\n"); |
501 | 501 | ||
502 | ucpia = kmalloc(sizeof(*ucpia), GFP_KERNEL); | 502 | ucpia = kzalloc(sizeof(*ucpia), GFP_KERNEL); |
503 | if (!ucpia) { | 503 | if (!ucpia) { |
504 | printk(KERN_ERR "couldn't kmalloc cpia struct\n"); | 504 | printk(KERN_ERR "couldn't kmalloc cpia struct\n"); |
505 | return -ENOMEM; | 505 | return -ENOMEM; |
506 | } | 506 | } |
507 | 507 | ||
508 | memset(ucpia, 0, sizeof(*ucpia)); | ||
509 | |||
510 | ucpia->dev = udev; | 508 | ucpia->dev = udev; |
511 | ucpia->iface = interface->desc.bInterfaceNumber; | 509 | ucpia->iface = interface->desc.bInterfaceNumber; |
512 | init_waitqueue_head(&ucpia->wq_stream); | 510 | init_waitqueue_head(&ucpia->wq_stream); |
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index b421068f7ea3..9a66b5961d19 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c | |||
@@ -141,11 +141,10 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind) | |||
141 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 141 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
142 | return 0; | 142 | return 0; |
143 | 143 | ||
144 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 144 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
145 | if (client == 0) | 145 | if (client == 0) |
146 | return -ENOMEM; | 146 | return -ENOMEM; |
147 | 147 | ||
148 | memset(client, 0, sizeof(struct i2c_client)); | ||
149 | client->addr = address; | 148 | client->addr = address; |
150 | client->adapter = adapter; | 149 | client->adapter = adapter; |
151 | client->driver = &i2c_driver; | 150 | client->driver = &i2c_driver; |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index d45237d508c4..c1734762436d 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -862,11 +862,10 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, | |||
862 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) | 862 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) |
863 | return 0; | 863 | return 0; |
864 | 864 | ||
865 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 865 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
866 | if (client == 0) | 866 | if (client == 0) |
867 | return -ENOMEM; | 867 | return -ENOMEM; |
868 | 868 | ||
869 | memset(client, 0, sizeof(struct i2c_client)); | ||
870 | client->addr = address; | 869 | client->addr = address; |
871 | client->adapter = adapter; | 870 | client->adapter = adapter; |
872 | client->driver = &i2c_driver_cx25840; | 871 | client->driver = &i2c_driver_cx25840; |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index a49062119313..a502a4d6e4ae 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1539,10 +1539,9 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1539 | dprintk(1,"open minor=%d\n",minor); | 1539 | dprintk(1,"open minor=%d\n",minor); |
1540 | 1540 | ||
1541 | /* allocate + initialize per filehandle data */ | 1541 | /* allocate + initialize per filehandle data */ |
1542 | fh = kmalloc(sizeof(*fh),GFP_KERNEL); | 1542 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
1543 | if (NULL == fh) | 1543 | if (NULL == fh) |
1544 | return -ENOMEM; | 1544 | return -ENOMEM; |
1545 | memset(fh,0,sizeof(*fh)); | ||
1546 | file->private_data = fh; | 1545 | file->private_data = fh; |
1547 | fh->dev = dev; | 1546 | fh->dev = dev; |
1548 | 1547 | ||
@@ -1678,10 +1677,9 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev, | |||
1678 | goto fail_core; | 1677 | goto fail_core; |
1679 | 1678 | ||
1680 | err = -ENOMEM; | 1679 | err = -ENOMEM; |
1681 | dev = kmalloc(sizeof(*dev),GFP_KERNEL); | 1680 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); |
1682 | if (NULL == dev) | 1681 | if (NULL == dev) |
1683 | goto fail_core; | 1682 | goto fail_core; |
1684 | memset(dev,0,sizeof(*dev)); | ||
1685 | dev->pci = pci_dev; | 1683 | dev->pci = pci_dev; |
1686 | dev->core = core; | 1684 | dev->core = core; |
1687 | dev->width = 720; | 1685 | dev->width = 720; |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 9975be1aca38..194446f28c55 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -1050,11 +1050,10 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) | |||
1050 | up(&devlist); | 1050 | up(&devlist); |
1051 | return core; | 1051 | return core; |
1052 | } | 1052 | } |
1053 | core = kmalloc(sizeof(*core),GFP_KERNEL); | 1053 | core = kzalloc(sizeof(*core),GFP_KERNEL); |
1054 | if (NULL == core) | 1054 | if (NULL == core) |
1055 | goto fail_unlock; | 1055 | goto fail_unlock; |
1056 | 1056 | ||
1057 | memset(core,0,sizeof(*core)); | ||
1058 | atomic_inc(&core->refcount); | 1057 | atomic_inc(&core->refcount); |
1059 | core->pci_bus = pci->bus->number; | 1058 | core->pci_bus = pci->bus->number; |
1060 | core->pci_slot = PCI_SLOT(pci->devfn); | 1059 | core->pci_slot = PCI_SLOT(pci->devfn); |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 42c012aaa849..e48aa3f6e500 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -657,10 +657,9 @@ static int __devinit dvb_probe(struct pci_dev *pci_dev, | |||
657 | goto fail_core; | 657 | goto fail_core; |
658 | 658 | ||
659 | err = -ENOMEM; | 659 | err = -ENOMEM; |
660 | dev = kmalloc(sizeof(*dev),GFP_KERNEL); | 660 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); |
661 | if (NULL == dev) | 661 | if (NULL == dev) |
662 | goto fail_core; | 662 | goto fail_core; |
663 | memset(dev,0,sizeof(*dev)); | ||
664 | dev->pci = pci_dev; | 663 | dev->pci = pci_dev; |
665 | dev->core = core; | 664 | dev->core = core; |
666 | 665 | ||
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 9a02515fe18b..073494ceab0f 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -750,10 +750,9 @@ static int video_open(struct inode *inode, struct file *file) | |||
750 | minor,radio,v4l2_type_names[type]); | 750 | minor,radio,v4l2_type_names[type]); |
751 | 751 | ||
752 | /* allocate + initialize per filehandle data */ | 752 | /* allocate + initialize per filehandle data */ |
753 | fh = kmalloc(sizeof(*fh),GFP_KERNEL); | 753 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
754 | if (NULL == fh) | 754 | if (NULL == fh) |
755 | return -ENOMEM; | 755 | return -ENOMEM; |
756 | memset(fh,0,sizeof(*fh)); | ||
757 | file->private_data = fh; | 756 | file->private_data = fh; |
758 | fh->dev = dev; | 757 | fh->dev = dev; |
759 | fh->radio = radio; | 758 | fh->radio = radio; |
@@ -1809,10 +1808,9 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1809 | struct cx88_core *core; | 1808 | struct cx88_core *core; |
1810 | int err; | 1809 | int err; |
1811 | 1810 | ||
1812 | dev = kmalloc(sizeof(*dev),GFP_KERNEL); | 1811 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); |
1813 | if (NULL == dev) | 1812 | if (NULL == dev) |
1814 | return -ENOMEM; | 1813 | return -ENOMEM; |
1815 | memset(dev,0,sizeof(*dev)); | ||
1816 | 1814 | ||
1817 | /* pci init */ | 1815 | /* pci init */ |
1818 | dev->pci = pci_dev; | 1816 | dev->pci = pci_dev; |
diff --git a/drivers/media/video/dpc7146.c b/drivers/media/video/dpc7146.c index da9481198c53..2831bdd12057 100644 --- a/drivers/media/video/dpc7146.c +++ b/drivers/media/video/dpc7146.c | |||
@@ -94,12 +94,11 @@ static int dpc_probe(struct saa7146_dev* dev) | |||
94 | struct i2c_client *client; | 94 | struct i2c_client *client; |
95 | struct list_head *item; | 95 | struct list_head *item; |
96 | 96 | ||
97 | dpc = (struct dpc*)kmalloc(sizeof(struct dpc), GFP_KERNEL); | 97 | dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL); |
98 | if( NULL == dpc ) { | 98 | if( NULL == dpc ) { |
99 | printk("dpc_v4l2.o: dpc_probe: not enough kernel memory.\n"); | 99 | printk("dpc_v4l2.o: dpc_probe: not enough kernel memory.\n"); |
100 | return -ENOMEM; | 100 | return -ENOMEM; |
101 | } | 101 | } |
102 | memset(dpc, 0x0, sizeof(struct dpc)); | ||
103 | 102 | ||
104 | /* FIXME: enable i2c-port pins, video-port-pins | 103 | /* FIXME: enable i2c-port pins, video-port-pins |
105 | video port pins should be enabled here ?! */ | 104 | video port pins should be enabled here ?! */ |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index fdc255918dde..3323dffe26a4 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -1861,12 +1861,11 @@ static int em28xx_usb_probe(struct usb_interface *interface, | |||
1861 | } | 1861 | } |
1862 | 1862 | ||
1863 | /* allocate memory for our device state and initialize it */ | 1863 | /* allocate memory for our device state and initialize it */ |
1864 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 1864 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
1865 | if (dev == NULL) { | 1865 | if (dev == NULL) { |
1866 | em28xx_err(DRIVER_NAME ": out of memory!\n"); | 1866 | em28xx_err(DRIVER_NAME ": out of memory!\n"); |
1867 | return -ENOMEM; | 1867 | return -ENOMEM; |
1868 | } | 1868 | } |
1869 | memset(dev, 0, sizeof(*dev)); | ||
1870 | 1869 | ||
1871 | /* compute alternate max packet sizes */ | 1870 | /* compute alternate max packet sizes */ |
1872 | uif = udev->actconfig->interface[0]; | 1871 | uif = udev->actconfig->interface[0]; |
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c index c9b00eafefde..e7bbeb11553d 100644 --- a/drivers/media/video/hexium_gemini.c +++ b/drivers/media/video/hexium_gemini.c | |||
@@ -240,12 +240,11 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d | |||
240 | 240 | ||
241 | DEB_EE((".\n")); | 241 | DEB_EE((".\n")); |
242 | 242 | ||
243 | hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL); | 243 | hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); |
244 | if (NULL == hexium) { | 244 | if (NULL == hexium) { |
245 | printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); | 245 | printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); |
246 | return -ENOMEM; | 246 | return -ENOMEM; |
247 | } | 247 | } |
248 | memset(hexium, 0x0, sizeof(struct hexium)); | ||
249 | dev->ext_priv = hexium; | 248 | dev->ext_priv = hexium; |
250 | 249 | ||
251 | /* enable i2c-port pins */ | 250 | /* enable i2c-port pins */ |
diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c index 42a9414155c3..0b6c2096ec66 100644 --- a/drivers/media/video/hexium_orion.c +++ b/drivers/media/video/hexium_orion.c | |||
@@ -224,12 +224,11 @@ static int hexium_probe(struct saa7146_dev *dev) | |||
224 | return -EFAULT; | 224 | return -EFAULT; |
225 | } | 225 | } |
226 | 226 | ||
227 | hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL); | 227 | hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); |
228 | if (NULL == hexium) { | 228 | if (NULL == hexium) { |
229 | printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); | 229 | printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); |
230 | return -ENOMEM; | 230 | return -ENOMEM; |
231 | } | 231 | } |
232 | memset(hexium, 0x0, sizeof(struct hexium)); | ||
233 | 232 | ||
234 | /* enable i2c-port pins */ | 233 | /* enable i2c-port pins */ |
235 | saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); | 234 | saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); |
diff --git a/drivers/media/video/indycam.c b/drivers/media/video/indycam.c index bb5cbecffcc3..7420b79e987a 100644 --- a/drivers/media/video/indycam.c +++ b/drivers/media/video/indycam.c | |||
@@ -289,18 +289,15 @@ static int indycam_attach(struct i2c_adapter *adap, int addr, int kind) | |||
289 | printk(KERN_INFO "SGI IndyCam driver version %s\n", | 289 | printk(KERN_INFO "SGI IndyCam driver version %s\n", |
290 | INDYCAM_MODULE_VERSION); | 290 | INDYCAM_MODULE_VERSION); |
291 | 291 | ||
292 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 292 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
293 | if (!client) | 293 | if (!client) |
294 | return -ENOMEM; | 294 | return -ENOMEM; |
295 | camera = kmalloc(sizeof(struct indycam), GFP_KERNEL); | 295 | camera = kzalloc(sizeof(struct indycam), GFP_KERNEL); |
296 | if (!camera) { | 296 | if (!camera) { |
297 | err = -ENOMEM; | 297 | err = -ENOMEM; |
298 | goto out_free_client; | 298 | goto out_free_client; |
299 | } | 299 | } |
300 | 300 | ||
301 | memset(client, 0, sizeof(struct i2c_client)); | ||
302 | memset(camera, 0, sizeof(struct indycam)); | ||
303 | |||
304 | client->addr = addr; | 301 | client->addr = addr; |
305 | client->adapter = adap; | 302 | client->adapter = adap; |
306 | client->driver = &i2c_driver_indycam; | 303 | client->driver = &i2c_driver_indycam; |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 91681aa6c657..8416ceff524b 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -177,12 +177,11 @@ static int mxb_probe(struct saa7146_dev* dev) | |||
177 | return -ENODEV; | 177 | return -ENODEV; |
178 | } | 178 | } |
179 | 179 | ||
180 | mxb = (struct mxb*)kmalloc(sizeof(struct mxb), GFP_KERNEL); | 180 | mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); |
181 | if( NULL == mxb ) { | 181 | if( NULL == mxb ) { |
182 | DEB_D(("not enough kernel memory.\n")); | 182 | DEB_D(("not enough kernel memory.\n")); |
183 | return -ENOMEM; | 183 | return -ENOMEM; |
184 | } | 184 | } |
185 | memset(mxb, 0x0, sizeof(struct mxb)); | ||
186 | 185 | ||
187 | mxb->i2c_adapter = (struct i2c_adapter) { | 186 | mxb->i2c_adapter = (struct i2c_adapter) { |
188 | .class = I2C_CLASS_TV_ANALOG, | 187 | .class = I2C_CLASS_TV_ANALOG, |
diff --git a/drivers/media/video/ovcamchip/ov6x20.c b/drivers/media/video/ovcamchip/ov6x20.c index b3f4d266cede..c04130dab127 100644 --- a/drivers/media/video/ovcamchip/ov6x20.c +++ b/drivers/media/video/ovcamchip/ov6x20.c | |||
@@ -178,10 +178,9 @@ static int ov6x20_init(struct i2c_client *c) | |||
178 | if (rc < 0) | 178 | if (rc < 0) |
179 | return rc; | 179 | return rc; |
180 | 180 | ||
181 | ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); | 181 | ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); |
182 | if (!s) | 182 | if (!s) |
183 | return -ENOMEM; | 183 | return -ENOMEM; |
184 | memset(s, 0, sizeof *s); | ||
185 | 184 | ||
186 | s->auto_brt = 1; | 185 | s->auto_brt = 1; |
187 | s->auto_exp = 1; | 186 | s->auto_exp = 1; |
diff --git a/drivers/media/video/ovcamchip/ov6x30.c b/drivers/media/video/ovcamchip/ov6x30.c index 6eab458ab792..73b94f51a85a 100644 --- a/drivers/media/video/ovcamchip/ov6x30.c +++ b/drivers/media/video/ovcamchip/ov6x30.c | |||
@@ -141,10 +141,9 @@ static int ov6x30_init(struct i2c_client *c) | |||
141 | if (rc < 0) | 141 | if (rc < 0) |
142 | return rc; | 142 | return rc; |
143 | 143 | ||
144 | ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); | 144 | ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); |
145 | if (!s) | 145 | if (!s) |
146 | return -ENOMEM; | 146 | return -ENOMEM; |
147 | memset(s, 0, sizeof *s); | ||
148 | 147 | ||
149 | s->auto_brt = 1; | 148 | s->auto_brt = 1; |
150 | s->auto_exp = 1; | 149 | s->auto_exp = 1; |
diff --git a/drivers/media/video/ovcamchip/ov76be.c b/drivers/media/video/ovcamchip/ov76be.c index 29bbdc05e3b6..11f6be924d8b 100644 --- a/drivers/media/video/ovcamchip/ov76be.c +++ b/drivers/media/video/ovcamchip/ov76be.c | |||
@@ -105,10 +105,9 @@ static int ov76be_init(struct i2c_client *c) | |||
105 | if (rc < 0) | 105 | if (rc < 0) |
106 | return rc; | 106 | return rc; |
107 | 107 | ||
108 | ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); | 108 | ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); |
109 | if (!s) | 109 | if (!s) |
110 | return -ENOMEM; | 110 | return -ENOMEM; |
111 | memset(s, 0, sizeof *s); | ||
112 | 111 | ||
113 | s->auto_brt = 1; | 112 | s->auto_brt = 1; |
114 | s->auto_exp = 1; | 113 | s->auto_exp = 1; |
diff --git a/drivers/media/video/ovcamchip/ov7x10.c b/drivers/media/video/ovcamchip/ov7x10.c index 6c383d4b14fa..5206e7913924 100644 --- a/drivers/media/video/ovcamchip/ov7x10.c +++ b/drivers/media/video/ovcamchip/ov7x10.c | |||
@@ -115,10 +115,9 @@ static int ov7x10_init(struct i2c_client *c) | |||
115 | if (rc < 0) | 115 | if (rc < 0) |
116 | return rc; | 116 | return rc; |
117 | 117 | ||
118 | ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); | 118 | ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); |
119 | if (!s) | 119 | if (!s) |
120 | return -ENOMEM; | 120 | return -ENOMEM; |
121 | memset(s, 0, sizeof *s); | ||
122 | 121 | ||
123 | s->auto_brt = 1; | 122 | s->auto_brt = 1; |
124 | s->auto_exp = 1; | 123 | s->auto_exp = 1; |
diff --git a/drivers/media/video/ovcamchip/ov7x20.c b/drivers/media/video/ovcamchip/ov7x20.c index 3c8c48f338ba..8e26ae338f31 100644 --- a/drivers/media/video/ovcamchip/ov7x20.c +++ b/drivers/media/video/ovcamchip/ov7x20.c | |||
@@ -232,10 +232,9 @@ static int ov7x20_init(struct i2c_client *c) | |||
232 | if (rc < 0) | 232 | if (rc < 0) |
233 | return rc; | 233 | return rc; |
234 | 234 | ||
235 | ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); | 235 | ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); |
236 | if (!s) | 236 | if (!s) |
237 | return -ENOMEM; | 237 | return -ENOMEM; |
238 | memset(s, 0, sizeof *s); | ||
239 | 238 | ||
240 | s->auto_brt = 1; | 239 | s->auto_brt = 1; |
241 | s->auto_exp = DFL_AUTO_EXP; | 240 | s->auto_exp = DFL_AUTO_EXP; |
diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index 428f1bb75ec3..e76b53d5909c 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c | |||
@@ -316,12 +316,11 @@ static int ovcamchip_attach(struct i2c_adapter *adap) | |||
316 | c->adapter = adap; | 316 | c->adapter = adap; |
317 | strcpy(c->name, "OV????"); | 317 | strcpy(c->name, "OV????"); |
318 | 318 | ||
319 | ov = kmalloc(sizeof *ov, GFP_KERNEL); | 319 | ov = kzalloc(sizeof *ov, GFP_KERNEL); |
320 | if (!ov) { | 320 | if (!ov) { |
321 | rc = -ENOMEM; | 321 | rc = -ENOMEM; |
322 | goto no_ov; | 322 | goto no_ov; |
323 | } | 323 | } |
324 | memset(ov, 0, sizeof *ov); | ||
325 | i2c_set_clientdata(c, ov); | 324 | i2c_set_clientdata(c, ov); |
326 | 325 | ||
327 | rc = ovcamchip_detect(c); | 326 | rc = ovcamchip_detect(c); |
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index 0aa9e72f632c..2ce010201308 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c | |||
@@ -83,13 +83,12 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind) | |||
83 | client_template.adapter = adap; | 83 | client_template.adapter = adap; |
84 | client_template.addr = addr; | 84 | client_template.addr = addr; |
85 | memcpy(client, &client_template, sizeof(*client)); | 85 | memcpy(client, &client_template, sizeof(*client)); |
86 | t = kmalloc(sizeof(*t), GFP_KERNEL); | 86 | t = kzalloc(sizeof(*t), GFP_KERNEL); |
87 | if(t==NULL) | 87 | if(t==NULL) |
88 | { | 88 | { |
89 | kfree(client); | 89 | kfree(client); |
90 | return -ENOMEM; | 90 | return -ENOMEM; |
91 | } | 91 | } |
92 | memset(t, 0, sizeof(*t)); | ||
93 | strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); | 92 | strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); |
94 | init_MUTEX(&t->lock); | 93 | init_MUTEX(&t->lock); |
95 | 94 | ||
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 73b4f0e2abf0..5694eb58c3a1 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -151,13 +151,12 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
151 | client_template.adapter = adap; | 151 | client_template.adapter = adap; |
152 | client_template.addr = addr; | 152 | client_template.addr = addr; |
153 | memcpy(client, &client_template, sizeof(*client)); | 153 | memcpy(client, &client_template, sizeof(*client)); |
154 | t = kmalloc(sizeof(*t), GFP_KERNEL); | 154 | t = kzalloc(sizeof(*t), GFP_KERNEL); |
155 | if(t==NULL) | 155 | if(t==NULL) |
156 | { | 156 | { |
157 | kfree(client); | 157 | kfree(client); |
158 | return -ENOMEM; | 158 | return -ENOMEM; |
159 | } | 159 | } |
160 | memset(t, 0, sizeof(*t)); | ||
161 | strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); | 160 | strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); |
162 | init_MUTEX(&t->lock); | 161 | init_MUTEX(&t->lock); |
163 | 162 | ||
@@ -165,7 +164,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
165 | * Now create a video4linux device | 164 | * Now create a video4linux device |
166 | */ | 165 | */ |
167 | 166 | ||
168 | vd = (struct video_device *)kmalloc(sizeof(struct video_device), GFP_KERNEL); | 167 | vd = kmalloc(sizeof(struct video_device), GFP_KERNEL); |
169 | if(vd==NULL) | 168 | if(vd==NULL) |
170 | { | 169 | { |
171 | kfree(t); | 170 | kfree(t); |
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index 619ff0b7a1ff..7bb85a7b326e 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c | |||
@@ -494,21 +494,19 @@ saa7110_detect_client (struct i2c_adapter *adapter, | |||
494 | I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) | 494 | I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) |
495 | return 0; | 495 | return 0; |
496 | 496 | ||
497 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 497 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
498 | if (client == 0) | 498 | if (client == 0) |
499 | return -ENOMEM; | 499 | return -ENOMEM; |
500 | memset(client, 0, sizeof(struct i2c_client)); | ||
501 | client->addr = address; | 500 | client->addr = address; |
502 | client->adapter = adapter; | 501 | client->adapter = adapter; |
503 | client->driver = &i2c_driver_saa7110; | 502 | client->driver = &i2c_driver_saa7110; |
504 | strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); | 503 | strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); |
505 | 504 | ||
506 | decoder = kmalloc(sizeof(struct saa7110), GFP_KERNEL); | 505 | decoder = kzalloc(sizeof(struct saa7110), GFP_KERNEL); |
507 | if (decoder == 0) { | 506 | if (decoder == 0) { |
508 | kfree(client); | 507 | kfree(client); |
509 | return -ENOMEM; | 508 | return -ENOMEM; |
510 | } | 509 | } |
511 | memset(decoder, 0, sizeof(struct saa7110)); | ||
512 | decoder->norm = VIDEO_MODE_PAL; | 510 | decoder->norm = VIDEO_MODE_PAL; |
513 | decoder->input = 0; | 511 | decoder->input = 0; |
514 | decoder->enable = 1; | 512 | decoder->enable = 1; |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index acaeee592b54..8c06592b37ff 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -511,21 +511,19 @@ saa7111_detect_client (struct i2c_adapter *adapter, | |||
511 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 511 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
512 | return 0; | 512 | return 0; |
513 | 513 | ||
514 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 514 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
515 | if (client == 0) | 515 | if (client == 0) |
516 | return -ENOMEM; | 516 | return -ENOMEM; |
517 | memset(client, 0, sizeof(struct i2c_client)); | ||
518 | client->addr = address; | 517 | client->addr = address; |
519 | client->adapter = adapter; | 518 | client->adapter = adapter; |
520 | client->driver = &i2c_driver_saa7111; | 519 | client->driver = &i2c_driver_saa7111; |
521 | strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client))); | 520 | strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client))); |
522 | 521 | ||
523 | decoder = kmalloc(sizeof(struct saa7111), GFP_KERNEL); | 522 | decoder = kzalloc(sizeof(struct saa7111), GFP_KERNEL); |
524 | if (decoder == NULL) { | 523 | if (decoder == NULL) { |
525 | kfree(client); | 524 | kfree(client); |
526 | return -ENOMEM; | 525 | return -ENOMEM; |
527 | } | 526 | } |
528 | memset(decoder, 0, sizeof(struct saa7111)); | ||
529 | decoder->norm = VIDEO_MODE_NTSC; | 527 | decoder->norm = VIDEO_MODE_NTSC; |
530 | decoder->input = 0; | 528 | decoder->input = 0; |
531 | decoder->enable = 1; | 529 | decoder->enable = 1; |
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index b7ac0122f729..fd0a4b4ef014 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c | |||
@@ -852,21 +852,19 @@ saa7114_detect_client (struct i2c_adapter *adapter, | |||
852 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 852 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
853 | return 0; | 853 | return 0; |
854 | 854 | ||
855 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 855 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
856 | if (client == 0) | 856 | if (client == 0) |
857 | return -ENOMEM; | 857 | return -ENOMEM; |
858 | memset(client, 0, sizeof(struct i2c_client)); | ||
859 | client->addr = address; | 858 | client->addr = address; |
860 | client->adapter = adapter; | 859 | client->adapter = adapter; |
861 | client->driver = &i2c_driver_saa7114; | 860 | client->driver = &i2c_driver_saa7114; |
862 | strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client))); | 861 | strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client))); |
863 | 862 | ||
864 | decoder = kmalloc(sizeof(struct saa7114), GFP_KERNEL); | 863 | decoder = kzalloc(sizeof(struct saa7114), GFP_KERNEL); |
865 | if (decoder == NULL) { | 864 | if (decoder == NULL) { |
866 | kfree(client); | 865 | kfree(client); |
867 | return -ENOMEM; | 866 | return -ENOMEM; |
868 | } | 867 | } |
869 | memset(decoder, 0, sizeof(struct saa7114)); | ||
870 | decoder->norm = VIDEO_MODE_NTSC; | 868 | decoder->norm = VIDEO_MODE_NTSC; |
871 | decoder->input = -1; | 869 | decoder->input = -1; |
872 | decoder->enable = 1; | 870 | decoder->enable = 1; |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 4a4bc69fb0e9..ab8b4bcb5dd6 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1249,10 +1249,9 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1249 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 1249 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
1250 | return 0; | 1250 | return 0; |
1251 | 1251 | ||
1252 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 1252 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
1253 | if (client == 0) | 1253 | if (client == 0) |
1254 | return -ENOMEM; | 1254 | return -ENOMEM; |
1255 | memset(client, 0, sizeof(struct i2c_client)); | ||
1256 | client->addr = address; | 1255 | client->addr = address; |
1257 | client->adapter = adapter; | 1256 | client->adapter = adapter; |
1258 | client->driver = &i2c_driver_saa7115; | 1257 | client->driver = &i2c_driver_saa7115; |
@@ -1272,13 +1271,12 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1272 | } | 1271 | } |
1273 | v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name); | 1272 | v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name); |
1274 | 1273 | ||
1275 | state = kmalloc(sizeof(struct saa7115_state), GFP_KERNEL); | 1274 | state = kzalloc(sizeof(struct saa7115_state), GFP_KERNEL); |
1276 | i2c_set_clientdata(client, state); | 1275 | i2c_set_clientdata(client, state); |
1277 | if (state == NULL) { | 1276 | if (state == NULL) { |
1278 | kfree(client); | 1277 | kfree(client); |
1279 | return -ENOMEM; | 1278 | return -ENOMEM; |
1280 | } | 1279 | } |
1281 | memset(state, 0, sizeof(struct saa7115_state)); | ||
1282 | state->std = V4L2_STD_NTSC; | 1280 | state->std = V4L2_STD_NTSC; |
1283 | state->input = -1; | 1281 | state->input = -1; |
1284 | state->enable = 1; | 1282 | state->enable = 1; |
diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index f39a7be08588..ae53063875f9 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c | |||
@@ -487,20 +487,18 @@ saa711x_detect_client (struct i2c_adapter *adapter, | |||
487 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 487 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
488 | return 0; | 488 | return 0; |
489 | 489 | ||
490 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 490 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
491 | if (client == 0) | 491 | if (client == 0) |
492 | return -ENOMEM; | 492 | return -ENOMEM; |
493 | memset(client, 0, sizeof(struct i2c_client)); | ||
494 | client->addr = address; | 493 | client->addr = address; |
495 | client->adapter = adapter; | 494 | client->adapter = adapter; |
496 | client->driver = &i2c_driver_saa711x; | 495 | client->driver = &i2c_driver_saa711x; |
497 | strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); | 496 | strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); |
498 | decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL); | 497 | decoder = kzalloc(sizeof(struct saa711x), GFP_KERNEL); |
499 | if (decoder == NULL) { | 498 | if (decoder == NULL) { |
500 | kfree(client); | 499 | kfree(client); |
501 | return -ENOMEM; | 500 | return -ENOMEM; |
502 | } | 501 | } |
503 | memset(decoder, 0, sizeof(struct saa711x)); | ||
504 | decoder->norm = VIDEO_MODE_NTSC; | 502 | decoder->norm = VIDEO_MODE_NTSC; |
505 | decoder->input = 0; | 503 | decoder->input = 0; |
506 | decoder->enable = 1; | 504 | decoder->enable = 1; |
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index 2009c1bc4720..d14eb3e5c962 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
@@ -689,11 +689,10 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) | |||
689 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 689 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
690 | return 0; | 690 | return 0; |
691 | 691 | ||
692 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 692 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
693 | if (client == 0) | 693 | if (client == 0) |
694 | return -ENOMEM; | 694 | return -ENOMEM; |
695 | 695 | ||
696 | memset(client, 0, sizeof(struct i2c_client)); | ||
697 | client->addr = address; | 696 | client->addr = address; |
698 | client->adapter = adapter; | 697 | client->adapter = adapter; |
699 | client->driver = &i2c_driver_saa7127; | 698 | client->driver = &i2c_driver_saa7127; |
@@ -712,7 +711,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) | |||
712 | kfree(client); | 711 | kfree(client); |
713 | return 0; | 712 | return 0; |
714 | } | 713 | } |
715 | state = kmalloc(sizeof(struct saa7127_state), GFP_KERNEL); | 714 | state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL); |
716 | 715 | ||
717 | if (state == NULL) { | 716 | if (state == NULL) { |
718 | kfree(client); | 717 | kfree(client); |
@@ -720,7 +719,6 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) | |||
720 | } | 719 | } |
721 | 720 | ||
722 | i2c_set_clientdata(client, state); | 721 | i2c_set_clientdata(client, state); |
723 | memset(state, 0, sizeof(struct saa7127_state)); | ||
724 | 722 | ||
725 | /* Configure Encoder */ | 723 | /* Configure Encoder */ |
726 | 724 | ||
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index ad73c4a60f2b..0e0ba50946e8 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -511,9 +511,8 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) | |||
511 | struct saa6752hs_state *h; | 511 | struct saa6752hs_state *h; |
512 | 512 | ||
513 | 513 | ||
514 | if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL))) | 514 | if (NULL == (h = kzalloc(sizeof(*h), GFP_KERNEL))) |
515 | return -ENOMEM; | 515 | return -ENOMEM; |
516 | memset(h,0,sizeof(*h)); | ||
517 | h->client = client_template; | 516 | h->client = client_template; |
518 | h->params = param_defaults; | 517 | h->params = param_defaults; |
519 | h->client.adapter = adap; | 518 | h->client.adapter = adap; |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index accbc32725cf..3983a6524cac 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -803,10 +803,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
803 | struct saa7134_mpeg_ops *mops; | 803 | struct saa7134_mpeg_ops *mops; |
804 | int err; | 804 | int err; |
805 | 805 | ||
806 | dev = kmalloc(sizeof(*dev),GFP_KERNEL); | 806 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); |
807 | if (NULL == dev) | 807 | if (NULL == dev) |
808 | return -ENOMEM; | 808 | return -ENOMEM; |
809 | memset(dev,0,sizeof(*dev)); | ||
810 | 809 | ||
811 | /* pci init */ | 810 | /* pci init */ |
812 | dev->pci = pci_dev; | 811 | dev->pci = pci_dev; |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index adfa8fe49a11..e97426bc85df 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1264,10 +1264,9 @@ static int video_open(struct inode *inode, struct file *file) | |||
1264 | v4l2_type_names[type]); | 1264 | v4l2_type_names[type]); |
1265 | 1265 | ||
1266 | /* allocate + initialize per filehandle data */ | 1266 | /* allocate + initialize per filehandle data */ |
1267 | fh = kmalloc(sizeof(*fh),GFP_KERNEL); | 1267 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
1268 | if (NULL == fh) | 1268 | if (NULL == fh) |
1269 | return -ENOMEM; | 1269 | return -ENOMEM; |
1270 | memset(fh,0,sizeof(*fh)); | ||
1271 | file->private_data = fh; | 1270 | file->private_data = fh; |
1272 | fh->dev = dev; | 1271 | fh->dev = dev; |
1273 | fh->radio = radio; | 1272 | fh->radio = radio; |
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index f72a9f796209..3ed0edb870a4 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
@@ -408,21 +408,19 @@ saa7185_detect_client (struct i2c_adapter *adapter, | |||
408 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 408 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
409 | return 0; | 409 | return 0; |
410 | 410 | ||
411 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 411 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
412 | if (client == 0) | 412 | if (client == 0) |
413 | return -ENOMEM; | 413 | return -ENOMEM; |
414 | memset(client, 0, sizeof(struct i2c_client)); | ||
415 | client->addr = address; | 414 | client->addr = address; |
416 | client->adapter = adapter; | 415 | client->adapter = adapter; |
417 | client->driver = &i2c_driver_saa7185; | 416 | client->driver = &i2c_driver_saa7185; |
418 | strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client))); | 417 | strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client))); |
419 | 418 | ||
420 | encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL); | 419 | encoder = kzalloc(sizeof(struct saa7185), GFP_KERNEL); |
421 | if (encoder == NULL) { | 420 | if (encoder == NULL) { |
422 | kfree(client); | 421 | kfree(client); |
423 | return -ENOMEM; | 422 | return -ENOMEM; |
424 | } | 423 | } |
425 | memset(encoder, 0, sizeof(struct saa7185)); | ||
426 | encoder->norm = VIDEO_MODE_NTSC; | 424 | encoder->norm = VIDEO_MODE_NTSC; |
427 | encoder->enable = 1; | 425 | encoder->enable = 1; |
428 | i2c_set_clientdata(client, encoder); | 426 | i2c_set_clientdata(client, encoder); |
diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c index 41f6f05a0436..746cadb8f1c4 100644 --- a/drivers/media/video/saa7191.c +++ b/drivers/media/video/saa7191.c | |||
@@ -571,18 +571,15 @@ static int saa7191_attach(struct i2c_adapter *adap, int addr, int kind) | |||
571 | printk(KERN_INFO "Philips SAA7191 driver version %s\n", | 571 | printk(KERN_INFO "Philips SAA7191 driver version %s\n", |
572 | SAA7191_MODULE_VERSION); | 572 | SAA7191_MODULE_VERSION); |
573 | 573 | ||
574 | client = kmalloc(sizeof(*client), GFP_KERNEL); | 574 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
575 | if (!client) | 575 | if (!client) |
576 | return -ENOMEM; | 576 | return -ENOMEM; |
577 | decoder = kmalloc(sizeof(*decoder), GFP_KERNEL); | 577 | decoder = kzalloc(sizeof(*decoder), GFP_KERNEL); |
578 | if (!decoder) { | 578 | if (!decoder) { |
579 | err = -ENOMEM; | 579 | err = -ENOMEM; |
580 | goto out_free_client; | 580 | goto out_free_client; |
581 | } | 581 | } |
582 | 582 | ||
583 | memset(client, 0, sizeof(struct i2c_client)); | ||
584 | memset(decoder, 0, sizeof(struct saa7191)); | ||
585 | |||
586 | client->addr = addr; | 583 | client->addr = addr; |
587 | client->adapter = adap; | 584 | client->adapter = adap; |
588 | client->driver = &i2c_driver_saa7191; | 585 | client->driver = &i2c_driver_saa7191; |
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 99261f15e66e..873796bedec8 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c | |||
@@ -300,10 +300,9 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr, int kind) | |||
300 | struct tda7432 *t; | 300 | struct tda7432 *t; |
301 | struct i2c_client *client; | 301 | struct i2c_client *client; |
302 | 302 | ||
303 | t = kmalloc(sizeof *t,GFP_KERNEL); | 303 | t = kzalloc(sizeof *t,GFP_KERNEL); |
304 | if (!t) | 304 | if (!t) |
305 | return -ENOMEM; | 305 | return -ENOMEM; |
306 | memset(t,0,sizeof *t); | ||
307 | 306 | ||
308 | client = &t->c; | 307 | client = &t->c; |
309 | memcpy(client,&client_template,sizeof(struct i2c_client)); | 308 | memcpy(client,&client_template,sizeof(struct i2c_client)); |
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index 299393bf900a..ef98c4982250 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c | |||
@@ -232,10 +232,9 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr, int kind) | |||
232 | struct i2c_client *client; | 232 | struct i2c_client *client; |
233 | dprintk("In tda9875_attach\n"); | 233 | dprintk("In tda9875_attach\n"); |
234 | 234 | ||
235 | t = kmalloc(sizeof *t,GFP_KERNEL); | 235 | t = kzalloc(sizeof *t,GFP_KERNEL); |
236 | if (!t) | 236 | if (!t) |
237 | return -ENOMEM; | 237 | return -ENOMEM; |
238 | memset(t,0,sizeof *t); | ||
239 | 238 | ||
240 | client = &t->c; | 239 | client = &t->c; |
241 | memcpy(client,&client_template,sizeof(struct i2c_client)); | 240 | memcpy(client,&client_template,sizeof(struct i2c_client)); |
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 9cf47dc65579..5815649bdc78 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -696,9 +696,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) | |||
696 | client_template.adapter = adap; | 696 | client_template.adapter = adap; |
697 | client_template.addr = addr; | 697 | client_template.addr = addr; |
698 | 698 | ||
699 | if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) | 699 | if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL))) |
700 | return -ENOMEM; | 700 | return -ENOMEM; |
701 | memset(t,0,sizeof(*t)); | ||
702 | 701 | ||
703 | t->client = client_template; | 702 | t->client = client_template; |
704 | t->std = 0; | 703 | t->std = 0; |
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index c4ba3742f5c7..4dcba5a4fff0 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
@@ -99,11 +99,10 @@ static int tea6420_detect(struct i2c_adapter *adapter, int address, int kind) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | /* allocate memory for client structure */ | 101 | /* allocate memory for client structure */ |
102 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 102 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
103 | if (0 == client) { | 103 | if (0 == client) { |
104 | return -ENOMEM; | 104 | return -ENOMEM; |
105 | } | 105 | } |
106 | memset(client, 0x0, sizeof(struct i2c_client)); | ||
107 | 106 | ||
108 | /* fill client structure */ | 107 | /* fill client structure */ |
109 | memcpy(client, &client_template, sizeof(struct i2c_client)); | 108 | memcpy(client, &client_template, sizeof(struct i2c_client)); |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 57bc585a6955..89d013ce5edb 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -410,10 +410,9 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
410 | client_template.adapter = adap; | 410 | client_template.adapter = adap; |
411 | client_template.addr = addr; | 411 | client_template.addr = addr; |
412 | 412 | ||
413 | t = kmalloc(sizeof(struct tuner), GFP_KERNEL); | 413 | t = kzalloc(sizeof(struct tuner), GFP_KERNEL); |
414 | if (NULL == t) | 414 | if (NULL == t) |
415 | return -ENOMEM; | 415 | return -ENOMEM; |
416 | memset(t, 0, sizeof(struct tuner)); | ||
417 | memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); | 416 | memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); |
418 | i2c_set_clientdata(&t->i2c, t); | 417 | i2c_set_clientdata(&t->i2c, t); |
419 | t->type = UNSET; | 418 | t->type = UNSET; |
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index b582943a0d3e..9baa6392e9b5 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -1468,10 +1468,9 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1468 | struct CHIPSTATE *chip; | 1468 | struct CHIPSTATE *chip; |
1469 | struct CHIPDESC *desc; | 1469 | struct CHIPDESC *desc; |
1470 | 1470 | ||
1471 | chip = kmalloc(sizeof(*chip),GFP_KERNEL); | 1471 | chip = kzalloc(sizeof(*chip),GFP_KERNEL); |
1472 | if (!chip) | 1472 | if (!chip) |
1473 | return -ENOMEM; | 1473 | return -ENOMEM; |
1474 | memset(chip,0,sizeof(*chip)); | ||
1475 | memcpy(&chip->c,&client_template,sizeof(struct i2c_client)); | 1474 | memcpy(&chip->c,&client_template,sizeof(struct i2c_client)); |
1476 | chip->c.adapter = adap; | 1475 | chip->c.adapter = adap; |
1477 | chip->c.addr = addr; | 1476 | chip->c.addr = addr; |
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index fd0acc5da667..5e71a354e879 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -719,8 +719,7 @@ tveeprom_command(struct i2c_client *client, | |||
719 | 719 | ||
720 | switch (cmd) { | 720 | switch (cmd) { |
721 | case 0: | 721 | case 0: |
722 | buf = kmalloc(256,GFP_KERNEL); | 722 | buf = kzalloc(256,GFP_KERNEL); |
723 | memset(buf,0,256); | ||
724 | tveeprom_read(client,buf,256); | 723 | tveeprom_read(client,buf,256); |
725 | tveeprom_hauppauge_analog(client, &eeprom,buf); | 724 | tveeprom_hauppauge_analog(client, &eeprom,buf); |
726 | kfree(buf); | 725 | kfree(buf); |
@@ -743,10 +742,9 @@ tveeprom_detect_client(struct i2c_adapter *adapter, | |||
743 | { | 742 | { |
744 | struct i2c_client *client; | 743 | struct i2c_client *client; |
745 | 744 | ||
746 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 745 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
747 | if (NULL == client) | 746 | if (NULL == client) |
748 | return -ENOMEM; | 747 | return -ENOMEM; |
749 | memset(client, 0, sizeof(struct i2c_client)); | ||
750 | client->addr = address; | 748 | client->addr = address; |
751 | client->adapter = adapter; | 749 | client->adapter = adapter; |
752 | client->driver = &i2c_driver_tveeprom; | 750 | client->driver = &i2c_driver_tveeprom; |
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index c35b8042eee5..e86b522938fd 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -1074,12 +1074,11 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter, | |||
1074 | return -ENOMEM; | 1074 | return -ENOMEM; |
1075 | memcpy(c, &client_template, sizeof(struct i2c_client)); | 1075 | memcpy(c, &client_template, sizeof(struct i2c_client)); |
1076 | 1076 | ||
1077 | core = kmalloc(sizeof(struct tvp5150), GFP_KERNEL); | 1077 | core = kzalloc(sizeof(struct tvp5150), GFP_KERNEL); |
1078 | if (core == 0) { | 1078 | if (core == 0) { |
1079 | kfree(c); | 1079 | kfree(c); |
1080 | return -ENOMEM; | 1080 | return -ENOMEM; |
1081 | } | 1081 | } |
1082 | memset(core, 0, sizeof(struct tvp5150)); | ||
1083 | i2c_set_clientdata(c, core); | 1082 | i2c_set_clientdata(c, core); |
1084 | 1083 | ||
1085 | rv = i2c_attach_client(c); | 1084 | rv = i2c_attach_client(c); |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index 2ab5b4093800..474a29bc1760 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -305,9 +305,8 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
305 | { | 305 | { |
306 | struct video_capability *cap = arg; | 306 | struct video_capability *cap = arg; |
307 | 307 | ||
308 | cap2 = kmalloc(sizeof(*cap2),GFP_KERNEL); | 308 | cap2 = kzalloc(sizeof(*cap2),GFP_KERNEL); |
309 | memset(cap, 0, sizeof(*cap)); | 309 | memset(cap, 0, sizeof(*cap)); |
310 | memset(cap2, 0, sizeof(*cap2)); | ||
311 | memset(&fbuf2, 0, sizeof(fbuf2)); | 310 | memset(&fbuf2, 0, sizeof(fbuf2)); |
312 | 311 | ||
313 | err = drv(inode, file, VIDIOC_QUERYCAP, cap2); | 312 | err = drv(inode, file, VIDIOC_QUERYCAP, cap2); |
@@ -422,9 +421,8 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
422 | { | 421 | { |
423 | struct video_window *win = arg; | 422 | struct video_window *win = arg; |
424 | 423 | ||
425 | fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); | 424 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); |
426 | memset(win,0,sizeof(*win)); | 425 | memset(win,0,sizeof(*win)); |
427 | memset(fmt2,0,sizeof(*fmt2)); | ||
428 | 426 | ||
429 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; | 427 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; |
430 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 428 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
@@ -461,8 +459,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
461 | struct video_window *win = arg; | 459 | struct video_window *win = arg; |
462 | int err1,err2; | 460 | int err1,err2; |
463 | 461 | ||
464 | fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); | 462 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); |
465 | memset(fmt2,0,sizeof(*fmt2)); | ||
466 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 463 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
467 | drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); | 464 | drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); |
468 | err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); | 465 | err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); |
@@ -595,8 +592,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
595 | pict->whiteness = get_v4l_control(inode, file, | 592 | pict->whiteness = get_v4l_control(inode, file, |
596 | V4L2_CID_WHITENESS, drv); | 593 | V4L2_CID_WHITENESS, drv); |
597 | 594 | ||
598 | fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); | 595 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); |
599 | memset(fmt2,0,sizeof(*fmt2)); | ||
600 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 596 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
601 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 597 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
602 | if (err < 0) { | 598 | if (err < 0) { |
@@ -622,8 +618,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
622 | set_v4l_control(inode, file, | 618 | set_v4l_control(inode, file, |
623 | V4L2_CID_WHITENESS, pict->whiteness, drv); | 619 | V4L2_CID_WHITENESS, pict->whiteness, drv); |
624 | 620 | ||
625 | fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); | 621 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); |
626 | memset(fmt2,0,sizeof(*fmt2)); | ||
627 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 622 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
628 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 623 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
629 | if (err < 0) | 624 | if (err < 0) |
@@ -846,9 +841,8 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
846 | { | 841 | { |
847 | struct video_mmap *mm = arg; | 842 | struct video_mmap *mm = arg; |
848 | 843 | ||
849 | fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); | 844 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); |
850 | memset(&buf2,0,sizeof(buf2)); | 845 | memset(&buf2,0,sizeof(buf2)); |
851 | memset(fmt2,0,sizeof(*fmt2)); | ||
852 | 846 | ||
853 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 847 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
854 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 848 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
@@ -942,8 +936,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
942 | { | 936 | { |
943 | struct vbi_format *fmt = arg; | 937 | struct vbi_format *fmt = arg; |
944 | 938 | ||
945 | fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); | 939 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); |
946 | memset(fmt2, 0, sizeof(*fmt2)); | ||
947 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; | 940 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; |
948 | 941 | ||
949 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 942 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
@@ -975,8 +968,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
975 | break; | 968 | break; |
976 | } | 969 | } |
977 | 970 | ||
978 | fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); | 971 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); |
979 | memset(fmt2, 0, sizeof(*fmt2)); | ||
980 | 972 | ||
981 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; | 973 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; |
982 | fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; | 974 | fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; |
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 9a6bf287e26a..9ef477523d27 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
@@ -52,10 +52,9 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) | |||
52 | struct page *pg; | 52 | struct page *pg; |
53 | int i; | 53 | int i; |
54 | 54 | ||
55 | sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); | 55 | sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); |
56 | if (NULL == sglist) | 56 | if (NULL == sglist) |
57 | return NULL; | 57 | return NULL; |
58 | memset(sglist,0,sizeof(struct scatterlist)*nr_pages); | ||
59 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { | 58 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { |
60 | pg = vmalloc_to_page(virt); | 59 | pg = vmalloc_to_page(virt); |
61 | if (NULL == pg) | 60 | if (NULL == pg) |
@@ -80,10 +79,9 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) | |||
80 | 79 | ||
81 | if (NULL == pages[0]) | 80 | if (NULL == pages[0]) |
82 | return NULL; | 81 | return NULL; |
83 | sglist = kmalloc(sizeof(*sglist) * nr_pages, GFP_KERNEL); | 82 | sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL); |
84 | if (NULL == sglist) | 83 | if (NULL == sglist) |
85 | return NULL; | 84 | return NULL; |
86 | memset(sglist, 0, sizeof(*sglist) * nr_pages); | ||
87 | 85 | ||
88 | if (NULL == pages[0]) | 86 | if (NULL == pages[0]) |
89 | goto nopage; | 87 | goto nopage; |
@@ -284,9 +282,8 @@ void* videobuf_alloc(unsigned int size) | |||
284 | { | 282 | { |
285 | struct videobuf_buffer *vb; | 283 | struct videobuf_buffer *vb; |
286 | 284 | ||
287 | vb = kmalloc(size,GFP_KERNEL); | 285 | vb = kzalloc(size,GFP_KERNEL); |
288 | if (NULL != vb) { | 286 | if (NULL != vb) { |
289 | memset(vb,0,size); | ||
290 | videobuf_dma_init(&vb->dma); | 287 | videobuf_dma_init(&vb->dma); |
291 | init_waitqueue_head(&vb->done); | 288 | init_waitqueue_head(&vb->done); |
292 | vb->magic = MAGIC_BUFFER; | 289 | vb->magic = MAGIC_BUFFER; |
diff --git a/drivers/media/video/videocodec.c b/drivers/media/video/videocodec.c index 839db622040d..8f271de57fd6 100644 --- a/drivers/media/video/videocodec.c +++ b/drivers/media/video/videocodec.c | |||
@@ -124,17 +124,13 @@ videocodec_attach (struct videocodec_master *master) | |||
124 | if (res == 0) { | 124 | if (res == 0) { |
125 | dprintk(3, "videocodec_attach '%s'\n", | 125 | dprintk(3, "videocodec_attach '%s'\n", |
126 | codec->name); | 126 | codec->name); |
127 | ptr = (struct attached_list *) | 127 | ptr = kzalloc(sizeof(struct attached_list), GFP_KERNEL); |
128 | kmalloc(sizeof(struct attached_list), | ||
129 | GFP_KERNEL); | ||
130 | if (!ptr) { | 128 | if (!ptr) { |
131 | dprintk(1, | 129 | dprintk(1, |
132 | KERN_ERR | 130 | KERN_ERR |
133 | "videocodec_attach: no memory\n"); | 131 | "videocodec_attach: no memory\n"); |
134 | goto out_kfree; | 132 | goto out_kfree; |
135 | } | 133 | } |
136 | memset(ptr, 0, | ||
137 | sizeof(struct attached_list)); | ||
138 | ptr->codec = codec; | 134 | ptr->codec = codec; |
139 | 135 | ||
140 | a = h->list; | 136 | a = h->list; |
@@ -249,14 +245,11 @@ videocodec_register (const struct videocodec *codec) | |||
249 | "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", | 245 | "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", |
250 | codec->name, codec->type, codec->flags, codec->magic); | 246 | codec->name, codec->type, codec->flags, codec->magic); |
251 | 247 | ||
252 | ptr = | 248 | ptr = kzalloc(sizeof(struct codec_list), GFP_KERNEL); |
253 | (struct codec_list *) kmalloc(sizeof(struct codec_list), | ||
254 | GFP_KERNEL); | ||
255 | if (!ptr) { | 249 | if (!ptr) { |
256 | dprintk(1, KERN_ERR "videocodec_register: no memory\n"); | 250 | dprintk(1, KERN_ERR "videocodec_register: no memory\n"); |
257 | return -ENOMEM; | 251 | return -ENOMEM; |
258 | } | 252 | } |
259 | memset(ptr, 0, sizeof(struct codec_list)); | ||
260 | ptr->codec = codec; | 253 | ptr->codec = codec; |
261 | 254 | ||
262 | if (!h) { | 255 | if (!h) { |
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 9a9902c56ae7..d5be25987142 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -52,10 +52,7 @@ struct video_device *video_device_alloc(void) | |||
52 | { | 52 | { |
53 | struct video_device *vfd; | 53 | struct video_device *vfd; |
54 | 54 | ||
55 | vfd = kmalloc(sizeof(*vfd),GFP_KERNEL); | 55 | vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); |
56 | if (NULL == vfd) | ||
57 | return NULL; | ||
58 | memset(vfd,0,sizeof(*vfd)); | ||
59 | return vfd; | 56 | return vfd; |
60 | } | 57 | } |
61 | 58 | ||
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 71b28e9e0850..c8fd8238904d 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -4499,13 +4499,11 @@ static int vino_init(void) | |||
4499 | dma_addr_t dma_dummy_address; | 4499 | dma_addr_t dma_dummy_address; |
4500 | int i; | 4500 | int i; |
4501 | 4501 | ||
4502 | vino_drvdata = (struct vino_settings *) | 4502 | vino_drvdata = kzalloc(sizeof(struct vino_settings), GFP_KERNEL); |
4503 | kmalloc(sizeof(struct vino_settings), GFP_KERNEL); | ||
4504 | if (!vino_drvdata) { | 4503 | if (!vino_drvdata) { |
4505 | vino_module_cleanup(vino_init_stage); | 4504 | vino_module_cleanup(vino_init_stage); |
4506 | return -ENOMEM; | 4505 | return -ENOMEM; |
4507 | } | 4506 | } |
4508 | memset(vino_drvdata, 0, sizeof(struct vino_settings)); | ||
4509 | vino_init_stage++; | 4507 | vino_init_stage++; |
4510 | 4508 | ||
4511 | /* create a dummy dma descriptor */ | 4509 | /* create a dummy dma descriptor */ |
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 8dcee8b60e21..d0a1e72ea8c4 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c | |||
@@ -621,13 +621,11 @@ vpx3220_detect_client (struct i2c_adapter *adapter, | |||
621 | (adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) | 621 | (adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) |
622 | return 0; | 622 | return 0; |
623 | 623 | ||
624 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 624 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
625 | if (client == NULL) { | 625 | if (client == NULL) { |
626 | return -ENOMEM; | 626 | return -ENOMEM; |
627 | } | 627 | } |
628 | 628 | ||
629 | memset(client, 0, sizeof(struct i2c_client)); | ||
630 | |||
631 | client->addr = address; | 629 | client->addr = address; |
632 | client->adapter = adapter; | 630 | client->adapter = adapter; |
633 | client->driver = &vpx3220_i2c_driver; | 631 | client->driver = &vpx3220_i2c_driver; |
@@ -675,12 +673,11 @@ vpx3220_detect_client (struct i2c_adapter *adapter, | |||
675 | sizeof(I2C_NAME(client))); | 673 | sizeof(I2C_NAME(client))); |
676 | } | 674 | } |
677 | 675 | ||
678 | decoder = kmalloc(sizeof(struct vpx3220), GFP_KERNEL); | 676 | decoder = kzalloc(sizeof(struct vpx3220), GFP_KERNEL); |
679 | if (decoder == NULL) { | 677 | if (decoder == NULL) { |
680 | kfree(client); | 678 | kfree(client); |
681 | return -ENOMEM; | 679 | return -ENOMEM; |
682 | } | 680 | } |
683 | memset(decoder, 0, sizeof(struct vpx3220)); | ||
684 | decoder->norm = VIDEO_MODE_PAL; | 681 | decoder->norm = VIDEO_MODE_PAL; |
685 | decoder->input = 0; | 682 | decoder->input = 0; |
686 | decoder->enable = 1; | 683 | decoder->enable = 1; |
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index c2e6d2e9f5f1..8cb64f8a8a91 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
@@ -166,11 +166,10 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind) | |||
166 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 166 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
167 | return 0; | 167 | return 0; |
168 | 168 | ||
169 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 169 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
170 | if (client == 0) | 170 | if (client == 0) |
171 | return -ENOMEM; | 171 | return -ENOMEM; |
172 | 172 | ||
173 | memset(client, 0, sizeof(struct i2c_client)); | ||
174 | client->addr = address; | 173 | client->addr = address; |
175 | client->adapter = adapter; | 174 | client->adapter = adapter; |
176 | client->driver = &i2c_driver; | 175 | client->driver = &i2c_driver; |
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 39a0d238900e..ea3288661a34 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -1050,7 +1050,7 @@ zr36057_init (struct zoran *zr) | |||
1050 | /* allocate memory *before* doing anything to the hardware | 1050 | /* allocate memory *before* doing anything to the hardware |
1051 | * in case allocation fails */ | 1051 | * in case allocation fails */ |
1052 | mem_needed = BUZ_NUM_STAT_COM * 4; | 1052 | mem_needed = BUZ_NUM_STAT_COM * 4; |
1053 | mem = (unsigned long) kmalloc(mem_needed, GFP_KERNEL); | 1053 | mem = kzalloc(mem_needed, GFP_KERNEL); |
1054 | vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL); | 1054 | vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL); |
1055 | if (!mem || !vdev) { | 1055 | if (!mem || !vdev) { |
1056 | dprintk(1, | 1056 | dprintk(1, |
@@ -1061,7 +1061,6 @@ zr36057_init (struct zoran *zr) | |||
1061 | kfree((void *)mem); | 1061 | kfree((void *)mem); |
1062 | return -ENOMEM; | 1062 | return -ENOMEM; |
1063 | } | 1063 | } |
1064 | memset((void *) mem, 0, mem_needed); | ||
1065 | zr->stat_com = (u32 *) mem; | 1064 | zr->stat_com = (u32 *) mem; |
1066 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { | 1065 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { |
1067 | zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */ | 1066 | zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */ |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 15283f44e79f..485553be190b 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -1345,7 +1345,7 @@ zoran_open (struct inode *inode, | |||
1345 | ZR_DEVNAME(zr), current->comm, current->pid, zr->user); | 1345 | ZR_DEVNAME(zr), current->comm, current->pid, zr->user); |
1346 | 1346 | ||
1347 | /* now, create the open()-specific file_ops struct */ | 1347 | /* now, create the open()-specific file_ops struct */ |
1348 | fh = kmalloc(sizeof(struct zoran_fh), GFP_KERNEL); | 1348 | fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL); |
1349 | if (!fh) { | 1349 | if (!fh) { |
1350 | dprintk(1, | 1350 | dprintk(1, |
1351 | KERN_ERR | 1351 | KERN_ERR |
@@ -1354,7 +1354,6 @@ zoran_open (struct inode *inode, | |||
1354 | res = -ENOMEM; | 1354 | res = -ENOMEM; |
1355 | goto open_unlock_and_return; | 1355 | goto open_unlock_and_return; |
1356 | } | 1356 | } |
1357 | memset(fh, 0, sizeof(struct zoran_fh)); | ||
1358 | /* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows | 1357 | /* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows |
1359 | * on norm-change! */ | 1358 | * on norm-change! */ |
1360 | fh->overlay_mask = | 1359 | fh->overlay_mask = |
diff --git a/drivers/media/video/zr36016.c b/drivers/media/video/zr36016.c index 4ed898585c70..10130ef67ea7 100644 --- a/drivers/media/video/zr36016.c +++ b/drivers/media/video/zr36016.c | |||
@@ -451,12 +451,11 @@ zr36016_setup (struct videocodec *codec) | |||
451 | return -ENOSPC; | 451 | return -ENOSPC; |
452 | } | 452 | } |
453 | //mem structure init | 453 | //mem structure init |
454 | codec->data = ptr = kmalloc(sizeof(struct zr36016), GFP_KERNEL); | 454 | codec->data = ptr = kzalloc(sizeof(struct zr36016), GFP_KERNEL); |
455 | if (NULL == ptr) { | 455 | if (NULL == ptr) { |
456 | dprintk(1, KERN_ERR "zr36016: Can't get enough memory!\n"); | 456 | dprintk(1, KERN_ERR "zr36016: Can't get enough memory!\n"); |
457 | return -ENOMEM; | 457 | return -ENOMEM; |
458 | } | 458 | } |
459 | memset(ptr, 0, sizeof(struct zr36016)); | ||
460 | 459 | ||
461 | snprintf(ptr->name, sizeof(ptr->name), "zr36016[%d]", | 460 | snprintf(ptr->name, sizeof(ptr->name), "zr36016[%d]", |
462 | zr36016_codecs); | 461 | zr36016_codecs); |
diff --git a/drivers/media/video/zr36050.c b/drivers/media/video/zr36050.c index 0144576a6123..bd0cd28543ca 100644 --- a/drivers/media/video/zr36050.c +++ b/drivers/media/video/zr36050.c | |||
@@ -813,12 +813,11 @@ zr36050_setup (struct videocodec *codec) | |||
813 | return -ENOSPC; | 813 | return -ENOSPC; |
814 | } | 814 | } |
815 | //mem structure init | 815 | //mem structure init |
816 | codec->data = ptr = kmalloc(sizeof(struct zr36050), GFP_KERNEL); | 816 | codec->data = ptr = kzalloc(sizeof(struct zr36050), GFP_KERNEL); |
817 | if (NULL == ptr) { | 817 | if (NULL == ptr) { |
818 | dprintk(1, KERN_ERR "zr36050: Can't get enough memory!\n"); | 818 | dprintk(1, KERN_ERR "zr36050: Can't get enough memory!\n"); |
819 | return -ENOMEM; | 819 | return -ENOMEM; |
820 | } | 820 | } |
821 | memset(ptr, 0, sizeof(struct zr36050)); | ||
822 | 821 | ||
823 | snprintf(ptr->name, sizeof(ptr->name), "zr36050[%d]", | 822 | snprintf(ptr->name, sizeof(ptr->name), "zr36050[%d]", |
824 | zr36050_codecs); | 823 | zr36050_codecs); |
diff --git a/drivers/media/video/zr36060.c b/drivers/media/video/zr36060.c index 129744a07abd..28fa31a5f150 100644 --- a/drivers/media/video/zr36060.c +++ b/drivers/media/video/zr36060.c | |||
@@ -919,12 +919,11 @@ zr36060_setup (struct videocodec *codec) | |||
919 | return -ENOSPC; | 919 | return -ENOSPC; |
920 | } | 920 | } |
921 | //mem structure init | 921 | //mem structure init |
922 | codec->data = ptr = kmalloc(sizeof(struct zr36060), GFP_KERNEL); | 922 | codec->data = ptr = kzalloc(sizeof(struct zr36060), GFP_KERNEL); |
923 | if (NULL == ptr) { | 923 | if (NULL == ptr) { |
924 | dprintk(1, KERN_ERR "zr36060: Can't get enough memory!\n"); | 924 | dprintk(1, KERN_ERR "zr36060: Can't get enough memory!\n"); |
925 | return -ENOMEM; | 925 | return -ENOMEM; |
926 | } | 926 | } |
927 | memset(ptr, 0, sizeof(struct zr36060)); | ||
928 | 927 | ||
929 | snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]", | 928 | snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]", |
930 | zr36060_codecs); | 929 | zr36060_codecs); |