aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvideo/vicam.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/usbvideo/vicam.c')
-rw-r--r--drivers/media/video/usbvideo/vicam.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index 2eb45829791c..efb878a7402e 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -488,20 +488,24 @@ vicam_open(struct inode *inode, struct file *file)
488 * rely on this fact forever. 488 * rely on this fact forever.
489 */ 489 */
490 490
491 lock_kernel();
491 if (cam->open_count > 0) { 492 if (cam->open_count > 0) {
492 printk(KERN_INFO 493 printk(KERN_INFO
493 "vicam_open called on already opened camera"); 494 "vicam_open called on already opened camera");
495 unlock_kernel();
494 return -EBUSY; 496 return -EBUSY;
495 } 497 }
496 498
497 cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL); 499 cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL);
498 if (!cam->raw_image) { 500 if (!cam->raw_image) {
501 unlock_kernel();
499 return -ENOMEM; 502 return -ENOMEM;
500 } 503 }
501 504
502 cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); 505 cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
503 if (!cam->framebuf) { 506 if (!cam->framebuf) {
504 kfree(cam->raw_image); 507 kfree(cam->raw_image);
508 unlock_kernel();
505 return -ENOMEM; 509 return -ENOMEM;
506 } 510 }
507 511
@@ -509,6 +513,7 @@ vicam_open(struct inode *inode, struct file *file)
509 if (!cam->cntrlbuf) { 513 if (!cam->cntrlbuf) {
510 kfree(cam->raw_image); 514 kfree(cam->raw_image);
511 rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); 515 rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
516 unlock_kernel();
512 return -ENOMEM; 517 return -ENOMEM;
513 } 518 }
514 519
@@ -526,6 +531,7 @@ vicam_open(struct inode *inode, struct file *file)
526 cam->open_count++; 531 cam->open_count++;
527 532
528 file->private_data = cam; 533 file->private_data = cam;
534 unlock_kernel();
529 535
530 return 0; 536 return 0;
531} 537}