diff mbox

[-next,1/2] media/s2255drv: return if vdev not found

Message ID 20100505060130.GG27064@bicker (mailing list archive)
State Accepted
Headers show

Commit Message

Dan Carpenter May 5, 2010, 6:01 a.m. UTC
None
diff mbox

Patch

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