diff options
-rw-r--r-- | drivers/usb/media/w9968cf.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index 9937fc64c8bf..78cd1a577d26 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c | |||
@@ -695,13 +695,12 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) | |||
695 | /* Allocate memory for the isochronous transfer buffers */ | 695 | /* Allocate memory for the isochronous transfer buffers */ |
696 | for (i = 0; i < W9968CF_URBS; i++) { | 696 | for (i = 0; i < W9968CF_URBS; i++) { |
697 | if (!(cam->transfer_buffer[i] = | 697 | if (!(cam->transfer_buffer[i] = |
698 | kmalloc(W9968CF_ISO_PACKETS*p_size, GFP_KERNEL))) { | 698 | kzalloc(W9968CF_ISO_PACKETS*p_size, GFP_KERNEL))) { |
699 | DBG(1, "Couldn't allocate memory for the isochronous " | 699 | DBG(1, "Couldn't allocate memory for the isochronous " |
700 | "transfer buffers (%u bytes)", | 700 | "transfer buffers (%u bytes)", |
701 | p_size * W9968CF_ISO_PACKETS) | 701 | p_size * W9968CF_ISO_PACKETS) |
702 | return -ENOMEM; | 702 | return -ENOMEM; |
703 | } | 703 | } |
704 | memset(cam->transfer_buffer[i], 0, W9968CF_ISO_PACKETS*p_size); | ||
705 | } | 704 | } |
706 | 705 | ||
707 | /* Allocate memory for the temporary frame buffer */ | 706 | /* Allocate memory for the temporary frame buffer */ |
@@ -3499,12 +3498,10 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3499 | return -ENODEV; | 3498 | return -ENODEV; |
3500 | 3499 | ||
3501 | cam = (struct w9968cf_device*) | 3500 | cam = (struct w9968cf_device*) |
3502 | kmalloc(sizeof(struct w9968cf_device), GFP_KERNEL); | 3501 | kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL); |
3503 | if (!cam) | 3502 | if (!cam) |
3504 | return -ENOMEM; | 3503 | return -ENOMEM; |
3505 | 3504 | ||
3506 | memset(cam, 0, sizeof(*cam)); | ||
3507 | |||
3508 | init_MUTEX(&cam->dev_sem); | 3505 | init_MUTEX(&cam->dev_sem); |
3509 | down(&cam->dev_sem); | 3506 | down(&cam->dev_sem); |
3510 | 3507 | ||
@@ -3532,21 +3529,19 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3532 | 3529 | ||
3533 | 3530 | ||
3534 | /* Allocate 2 bytes of memory for camera control USB transfers */ | 3531 | /* Allocate 2 bytes of memory for camera control USB transfers */ |
3535 | if (!(cam->control_buffer = kmalloc(2, GFP_KERNEL))) { | 3532 | if (!(cam->control_buffer = kzalloc(2, GFP_KERNEL))) { |
3536 | DBG(1,"Couldn't allocate memory for camera control transfers") | 3533 | DBG(1,"Couldn't allocate memory for camera control transfers") |
3537 | err = -ENOMEM; | 3534 | err = -ENOMEM; |
3538 | goto fail; | 3535 | goto fail; |
3539 | } | 3536 | } |
3540 | memset(cam->control_buffer, 0, 2); | ||
3541 | 3537 | ||
3542 | /* Allocate 8 bytes of memory for USB data transfers to the FSB */ | 3538 | /* Allocate 8 bytes of memory for USB data transfers to the FSB */ |
3543 | if (!(cam->data_buffer = kmalloc(8, GFP_KERNEL))) { | 3539 | if (!(cam->data_buffer = kzalloc(8, GFP_KERNEL))) { |
3544 | DBG(1, "Couldn't allocate memory for data " | 3540 | DBG(1, "Couldn't allocate memory for data " |
3545 | "transfers to the FSB") | 3541 | "transfers to the FSB") |
3546 | err = -ENOMEM; | 3542 | err = -ENOMEM; |
3547 | goto fail; | 3543 | goto fail; |
3548 | } | 3544 | } |
3549 | memset(cam->data_buffer, 0, 8); | ||
3550 | 3545 | ||
3551 | /* Register the V4L device */ | 3546 | /* Register the V4L device */ |
3552 | cam->v4ldev = video_device_alloc(); | 3547 | cam->v4ldev = video_device_alloc(); |