[-next,1/2] media/s2255drv: return if vdev not found
Commit Message
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>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -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