diff options
author | Dan Carpenter <error27@gmail.com> | 2010-05-05 08:01:30 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 17:59:14 +0200 |
commit | aab9796f5580a988c46c130a727cdc398a05317b (patch) | |
tree | dc03abc84addf0ba87bb1da79ac4842ea4c9cefc | |
parent | V4L/DVB: ov511: cleanup: remove unneeded null check (diff) | |
download | linux-aab9796f5580a988c46c130a727cdc398a05317b.tar.xz linux-aab9796f5580a988c46c130a727cdc398a05317b.zip |
V4L/DVB: s2255drv: return if vdev not found
The original code didn't handle the case where vdev was not found so I
added a check for that.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: linux-dev@sensoray.com
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/s2255drv.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index ac9c40cf5835..1f9a49e054a8 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -1716,11 +1716,15 @@ static int s2255_open(struct file *file) dprintk(1, "s2255: open called (dev=%s)\n", video_device_node_name(vdev)); - for (i = 0; i < MAX_CHANNELS; i++) + for (i = 0; i < MAX_CHANNELS; i++) { if (&dev->vdev[i] == vdev) { cur_channel = i; break; } + } + if (i == MAX_CHANNELS) + return -ENODEV; + /* * open lock necessary to prevent multiple instances * of v4l-conf (or other programs) from simultaneously |