Skip to content

Commit 6c3df5d

Browse files
mszyprowmchehab
authored andcommitted
[media] media: v4l2-dev: fix video device index assignment
The side effect of commit 1056e43 ("v4l2-dev: Fix race condition on __video_register_device") is the increased number of index value assigned on video_device registration. Before that commit video_devices were numbered from 0, after it, the indexes starts from 1, because get_index() always count the device, which is being registered. Some device drivers rely on video_device index number for internal purposes, i.e. s5p-mfc driver stopped working after that patch. This patch restores the old method of numbering the video_device indexes. Cc: stable@vger.kernel.org # for v3.12 Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Ricardo Ribalda <ricardo.ribalda@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
1 parent 587d1b0 commit 6c3df5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/media/v4l2-core/v4l2-dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
872872

873873
/* Should not happen since we thought this minor was free */
874874
WARN_ON(video_device[vdev->minor] != NULL);
875-
video_device[vdev->minor] = vdev;
876875
vdev->index = get_index(vdev);
876+
video_device[vdev->minor] = vdev;
877877
mutex_unlock(&videodev_lock);
878878

879879
if (vdev->ioctl_ops)

0 commit comments

Comments
 (0)