diff options
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); | |||
2023 | static int get_index(struct video_device *vdev, int num) | 2023 | static int get_index(struct video_device *vdev, int num) |
2024 | { | 2024 | { |
2025 | u32 used = 0; | 2025 | u32 used = 0; |
2026 | const unsigned max_index = sizeof(used) * 8 - 1; | 2026 | const int max_index = sizeof(used) * 8 - 1; |
2027 | int i; | 2027 | int i; |
2028 | 2028 | ||
2029 | /* Currently a single v4l driver instance cannot create more than | 2029 | /* 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, | |||
2145 | vfd->minor=i; | 2145 | vfd->minor=i; |
2146 | 2146 | ||
2147 | ret = get_index(vfd, index); | 2147 | ret = get_index(vfd, index); |
2148 | vfd->index = ret; | ||
2149 | |||
2150 | mutex_unlock(&videodev_lock); | ||
2151 | |||
2148 | if (ret < 0) { | 2152 | if (ret < 0) { |
2149 | printk(KERN_ERR "%s: get_index failed\n", __func__); | 2153 | printk(KERN_ERR "%s: get_index failed\n", __func__); |
2150 | goto fail_minor; | 2154 | goto fail_minor; |
2151 | } | 2155 | } |
2152 | 2156 | ||
2153 | vfd->index = ret; | ||
2154 | |||
2155 | mutex_unlock(&videodev_lock); | ||
2156 | mutex_init(&vfd->lock); | 2157 | mutex_init(&vfd->lock); |
2157 | 2158 | ||
2158 | /* sysfs class */ | 2159 | /* sysfs class */ |