diff options
Diffstat (limited to 'drivers/media/video/v4l2-dev.c')
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index a7702e3d149c..0ca7978654b5 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -236,20 +236,20 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) | |||
236 | static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 236 | static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
237 | { | 237 | { |
238 | struct video_device *vdev = video_devdata(filp); | 238 | struct video_device *vdev = video_devdata(filp); |
239 | int ret; | 239 | int ret = -ENODEV; |
240 | 240 | ||
241 | if (!vdev->fops->ioctl) | ||
242 | return -ENOTTY; | ||
243 | if (vdev->fops->unlocked_ioctl) { | 241 | if (vdev->fops->unlocked_ioctl) { |
244 | if (vdev->lock) | 242 | if (vdev->lock) |
245 | mutex_lock(vdev->lock); | 243 | mutex_lock(vdev->lock); |
246 | ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); | 244 | if (video_is_registered(vdev)) |
245 | ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); | ||
247 | if (vdev->lock) | 246 | if (vdev->lock) |
248 | mutex_unlock(vdev->lock); | 247 | mutex_unlock(vdev->lock); |
249 | } else if (vdev->fops->ioctl) { | 248 | } else if (vdev->fops->ioctl) { |
250 | /* TODO: convert all drivers to unlocked_ioctl */ | 249 | /* TODO: convert all drivers to unlocked_ioctl */ |
251 | lock_kernel(); | 250 | lock_kernel(); |
252 | ret = vdev->fops->ioctl(filp, cmd, arg); | 251 | if (video_is_registered(vdev)) |
252 | ret = vdev->fops->ioctl(filp, cmd, arg); | ||
253 | unlock_kernel(); | 253 | unlock_kernel(); |
254 | } else | 254 | } else |
255 | ret = -ENOTTY; | 255 | ret = -ENOTTY; |