aboutsummaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-07-17 17:48:38 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 07:28:44 -0300
commitc3fb62bf927cee771c3bcd5053e393e7df518f28 (patch)
tree57819aaabfccac45fc135579aa5f266f01ca5cba /drivers/media
parent8373a3e512c8ea8e93981d42b0d1efb252be17fa (diff)
V4L/DVB (8390): videodev: add comment and remove magic number.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/videodev.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index bf12b5f850e..aca36dec674 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -2023,9 +2023,13 @@ EXPORT_SYMBOL(video_ioctl2);
static int get_index(struct video_device *vdev, int num)
{
u32 used = 0;
+ const unsigned max_index = sizeof(used) * 8 - 1;
int i;
- if (num >= 32) {
+ /* Currently a single v4l driver instance cannot create more than
+ 32 devices.
+ Increase to u64 or an array of u32 if more are needed. */
+ if (num > max_index) {
printk(KERN_ERR "videodev: %s num is too large\n", __func__);
return -EINVAL;
}
@@ -2045,7 +2049,7 @@ static int get_index(struct video_device *vdev, int num)
}
i = ffz(used);
- return i >= 32 ? -ENFILE : i;
+ return i > max_index ? -ENFILE : i;
}
static const struct file_operations video_fops;