summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-07-17 19:48:38 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2008-07-17 19:48:38 +0200
commit167ec40d5f9fd58be2b1a605de47d0f4b8c2dda5 (patch)
treeafc09d68094e1bd05cdab9eceac5e6dbed7b3a32
parentcdb4e5f01f68efa6fa2f585413b35c2b7726fb06 (diff)
downloadmediapointer-dvb-s2-167ec40d5f9fd58be2b1a605de47d0f4b8c2dda5.tar.gz
mediapointer-dvb-s2-167ec40d5f9fd58be2b1a605de47d0f4b8c2dda5.tar.bz2
videodev: add comment and remove magic number.
From: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
-rw-r--r--linux/drivers/media/video/videodev.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c
index 029f19664..10c6377bf 100644
--- a/linux/drivers/media/video/videodev.c
+++ b/linux/drivers/media/video/videodev.c
@@ -2059,9 +2059,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;
}
@@ -2081,7 +2085,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;