From 3fd0e9da79ce16cb29bd106c257e9861b4e07c62 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 9 Oct 2010 16:43:40 -0300 Subject: [PATCH] --- yaml --- r: 219230 b: refs/heads/master c: 7242063018c06977dc6825026b3075076e6f227b h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/media/video/v4l2-dev.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 801e6c5fb722..c5926e77b2e3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: be737a826949760b75c3b46fc86686274965fca1 +refs/heads/master: 7242063018c06977dc6825026b3075076e6f227b diff --git a/trunk/drivers/media/video/v4l2-dev.c b/trunk/drivers/media/video/v4l2-dev.c index a7702e3d149c..0ca7978654b5 100644 --- a/trunk/drivers/media/video/v4l2-dev.c +++ b/trunk/drivers/media/video/v4l2-dev.c @@ -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;