diff options
author | Panagiotis Issaris <takis@issaris.org> | 2006-01-11 19:40:56 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-11 19:40:56 -0200 |
commit | 7408187d223f63d46a13b6a35b8f96b032c2f623 (patch) | |
tree | 425a459f760295de488f57e3f97b034aaa76a78d /drivers/media/dvb/dvb-usb | |
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>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dtt200u-fe.c | 3 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-init.c | 6 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 9 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/vp702x-fe.c | 3 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/vp7045-fe.c | 3 |
5 files changed, 8 insertions, 16 deletions
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) struct dtt200u_fe_state* state = NULL; /* allocate memory for the internal state */ - state = (struct dtt200u_fe_state*) kmalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); + state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct dtt200u_fe_state)); deb_info("attaching frontend dtt200u\n"); diff --git a/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 } info("found a '%s' in warm state.",desc->name); - d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); + d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); if (d == NULL) { err("no memory for 'struct dvb_usb_device'"); return ret; } - memset(d,0,sizeof(struct dvb_usb_device)); d->udev = udev; memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); @@ -167,13 +166,12 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties d->owner = owner; if (d->props.size_of_priv > 0) { - d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); + d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL); if (d->priv == NULL) { err("no memory for priv in 'struct dvb_usb_device'"); kfree(d); return -ENOMEM; } - memset(d->priv,0,d->props.size_of_priv); } usb_set_intfdata(intf, d); diff --git a/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 deb_mem("all in all I will use %lu bytes for streaming\n",num*size); - if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL) + if ((d->buf_list = kcalloc(num, sizeof(u8 *), GFP_ATOMIC)) == NULL) return -ENOMEM; - if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { + if ((d->dma_addr = kcalloc(num, sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { kfree(d->buf_list); return -ENOMEM; } - memset(d->buf_list,0,num*sizeof(u8 *)); - memset(d->dma_addr,0,num*sizeof(dma_addr_t)); d->state |= DVB_USB_STATE_URB_BUF; @@ -285,10 +283,9 @@ int dvb_usb_urb_init(struct dvb_usb_device *d) usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint)); /* allocate the array for the data transfer URBs */ - d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); + d->urb_list = kzalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); if (d->urb_list == NULL) return -ENOMEM; - memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *)); d->state |= DVB_USB_STATE_URB_LIST; switch (d->props.urb.type) { diff --git a/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; struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) { - struct vp702x_fe_state *s = kmalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); + struct vp702x_fe_state *s = kzalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); if (s == NULL) goto error; - memset(s,0,sizeof(struct vp702x_fe_state)); s->d = d; s->fe.ops = &vp702x_fe_ops; diff --git a/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; struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) { - struct vp7045_fe_state *s = kmalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); + struct vp7045_fe_state *s = kzalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); if (s == NULL) goto error; - memset(s,0,sizeof(struct vp7045_fe_state)); s->d = d; s->fe.ops = &vp7045_fe_ops; |