summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/videodev.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-07-18 12:07:10 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2008-07-18 12:07:10 +0200
commit7b91fd8cc5e261bfdacc0ba47b74f0411bbbfafb (patch)
tree99ed38371451f8207a66dbf117f97612c3681d5d /linux/drivers/media/video/videodev.c
parentba9ada241fb72554a85cf3ae478d3de60e4ead69 (diff)
downloadmediapointer-dvb-s2-7b91fd8cc5e261bfdacc0ba47b74f0411bbbfafb.tar.gz
mediapointer-dvb-s2-7b91fd8cc5e261bfdacc0ba47b74f0411bbbfafb.tar.bz2
videodev/cx18: fix get_index bug and error-handling lock-ups
From: Hans Verkuil <hverkuil@xs4all.nl> Fix a bug in get_index that was introduced earlier. Also fix two error handling lock-ups in videodev and cx18 that where found thanks to that bug. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/videodev.c')
-rw-r--r--linux/drivers/media/video/videodev.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c
index 10c6377bf..b32b59afd 100644
--- a/linux/drivers/media/video/videodev.c
+++ b/linux/drivers/media/video/videodev.c
@@ -2059,7 +2059,7 @@ 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;
+ const int max_index = sizeof(used) * 8 - 1;
int i;
/* Currently a single v4l driver instance cannot create more than
@@ -2181,14 +2181,15 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
vfd->minor=i;
ret = get_index(vfd, index);
+ vfd->index = ret;
+
+ mutex_unlock(&videodev_lock);
+
if (ret < 0) {
printk(KERN_ERR "%s: get_index failed\n", __func__);
goto fail_minor;
}
- vfd->index = ret;
-
- mutex_unlock(&videodev_lock);
mutex_init(&vfd->lock);
/* sysfs class */