@@ -222,8 +222,8 @@ static int v4l2_ioctl(struct inode *inode, struct file *filp,
if (!vdev->fops->ioctl)
return -ENOTTY;
- /* Allow ioctl to continue even if the device was unregistered.
- Things like dequeueing buffers might still be useful. */
+ if (!video_is_registered(vdev))
+ return -ENODEV;
return vdev->fops->ioctl(filp, cmd, arg);
}
@@ -234,8 +234,8 @@ static long v4l2_unlocked_ioctl(struct file *filp,
if (!vdev->fops->unlocked_ioctl)
return -ENOTTY;
- /* Allow ioctl to continue even if the device was unregistered.
- Things like dequeueing buffers might still be useful. */
+ if (!video_is_registered(vdev))
+ return -ENODEV;
return vdev->fops->unlocked_ioctl(filp, cmd, arg);
}