diff options
Diffstat (limited to 'drivers/media/video/stk-webcam.c')
-rw-r--r-- | drivers/media/video/stk-webcam.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index ad36af30e099..6b1ef5dc562c 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -689,11 +689,15 @@ static int v4l_stk_open(struct inode *inode, struct file *fp) | |||
689 | vdev = video_devdata(fp); | 689 | vdev = video_devdata(fp); |
690 | dev = vdev_to_camera(vdev); | 690 | dev = vdev_to_camera(vdev); |
691 | 691 | ||
692 | if (dev == NULL || !is_present(dev)) | 692 | lock_kernel(); |
693 | if (dev == NULL || !is_present(dev)) { | ||
694 | unlock_kernel(); | ||
693 | return -ENXIO; | 695 | return -ENXIO; |
696 | } | ||
694 | fp->private_data = vdev; | 697 | fp->private_data = vdev; |
695 | kref_get(&dev->kref); | 698 | kref_get(&dev->kref); |
696 | usb_autopm_get_interface(dev->interface); | 699 | usb_autopm_get_interface(dev->interface); |
700 | unlock_kernel(); | ||
697 | 701 | ||
698 | return 0; | 702 | return 0; |
699 | } | 703 | } |