V4L/DVB: Fix a merge conflict that affects unlock_ioctl
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 9 Oct 2010 19:43:40 +0000 (16:43 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:16:58 +0000 (01:16 -0200)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-dev.c

index a7702e3d149c04aaaa2638bc536eb00c8863a2ab..0ca7978654b56699989a01222fdf9bcdd6fbd45b 100644 (file)
@@ -236,20 +236,20 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll)
 static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
        struct video_device *vdev = video_devdata(filp);
-       int ret;
+       int ret = -ENODEV;
 
-       if (!vdev->fops->ioctl)
-               return -ENOTTY;
        if (vdev->fops->unlocked_ioctl) {
                if (vdev->lock)
                        mutex_lock(vdev->lock);
-               ret = vdev->fops->unlocked_ioctl(filp, cmd, arg);
+               if (video_is_registered(vdev))
+                       ret = vdev->fops->unlocked_ioctl(filp, cmd, arg);
                if (vdev->lock)
                        mutex_unlock(vdev->lock);
        } else if (vdev->fops->ioctl) {
                /* TODO: convert all drivers to unlocked_ioctl */
                lock_kernel();
-               ret = vdev->fops->ioctl(filp, cmd, arg);
+               if (video_is_registered(vdev))
+                       ret = vdev->fops->ioctl(filp, cmd, arg);
                unlock_kernel();
        } else
                ret = -ENOTTY;