From: Dan Carpenter <error27@gmail.com>
To: linux-media@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: [patch -next 1/2] media/s2255drv: return if vdev not found
Date: Wed, 5 May 2010 08:01:30 +0200 [thread overview]
Message-ID: <20100505060130.GG27064@bicker> (raw)
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>
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index ac9c40c..1f9a49e 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
reply other threads:[~2010-05-05 6:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100505060130.GG27064@bicker \
--to=error27@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox