public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [patch -next 1/2] media/s2255drv: return if vdev not found
@ 2010-05-05  6:01 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-05-05  6:01 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-05  6:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05  6:01 [patch -next 1/2] media/s2255drv: return if vdev not found Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox