aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/zr364xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/zr364xx.c')
-rw-r--r--drivers/media/video/zr364xx.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c
index 4e1ef10d22df..9d5d5985a7ea 100644
--- a/drivers/media/video/zr364xx.c
+++ b/drivers/media/video/zr364xx.c
@@ -641,25 +641,23 @@ static int zr364xx_open(struct inode *inode, struct file *file)
641 641
642 DBG("zr364xx_open"); 642 DBG("zr364xx_open");
643 643
644 mutex_lock(&cam->lock);
645
644 cam->skip = 2; 646 cam->skip = 2;
645 647
646 lock_kernel();
647 err = video_exclusive_open(inode, file); 648 err = video_exclusive_open(inode, file);
648 if (err < 0) { 649 if (err < 0)
649 unlock_kernel(); 650 goto out;
650 return err;
651 }
652 651
653 if (!cam->framebuf) { 652 if (!cam->framebuf) {
654 cam->framebuf = vmalloc_32(MAX_FRAME_SIZE * FRAMES); 653 cam->framebuf = vmalloc_32(MAX_FRAME_SIZE * FRAMES);
655 if (!cam->framebuf) { 654 if (!cam->framebuf) {
656 info("vmalloc_32 failed!"); 655 info("vmalloc_32 failed!");
657 unlock_kernel(); 656 err = -ENOMEM;
658 return -ENOMEM; 657 goto out;
659 } 658 }
660 } 659 }
661 660
662 mutex_lock(&cam->lock);
663 for (i = 0; init[cam->method][i].size != -1; i++) { 661 for (i = 0; init[cam->method][i].size != -1; i++) {
664 err = 662 err =
665 send_control_msg(udev, 1, init[cam->method][i].value, 663 send_control_msg(udev, 1, init[cam->method][i].value,
@@ -667,9 +665,7 @@ static int zr364xx_open(struct inode *inode, struct file *file)
667 init[cam->method][i].size); 665 init[cam->method][i].size);
668 if (err < 0) { 666 if (err < 0) {
669 info("error during open sequence: %d", i); 667 info("error during open sequence: %d", i);
670 mutex_unlock(&cam->lock); 668 goto out;
671 unlock_kernel();
672 return err;
673 } 669 }
674 } 670 }
675 671
@@ -679,10 +675,11 @@ static int zr364xx_open(struct inode *inode, struct file *file)
679 * like Ekiga does during its startup, can crash the webcam 675 * like Ekiga does during its startup, can crash the webcam
680 */ 676 */
681 mdelay(100); 677 mdelay(100);
678 err = 0;
682 679
680out:
683 mutex_unlock(&cam->lock); 681 mutex_unlock(&cam->lock);
684 unlock_kernel(); 682 return err;
685 return 0;
686} 683}
687 684
688 685