diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-07-18 17:07:10 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 14:29:27 +0400 |
commit | fac3639d886ae577d74e2da16e6a448620d432c9 (patch) | |
tree | 2771f7bd1e2f7225b451dc5a272f30b5515e90e4 /drivers/media/video/videodev.c | |
parent | f19ad390146e7745cbc529f3bef8469cf21f3a6b (diff) | |
download | linux-fac3639d886ae577d74e2da16e6a448620d432c9.tar.xz |
V4L/DVB (8414): videodev/cx18: fix get_index bug and error-handling lock-ups
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/videodev.c')
-rw-r--r-- | drivers/media/video/videodev.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index aca36dec6746..6616e6570557 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c @@ -2023,7 +2023,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 @@ -2145,14 +2145,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 */ |