|
@@ -868,6 +868,7 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
|
|
|
|
|
|
/* Should not happen since we thought this minor was free */
|
|
|
WARN_ON(video_device[vdev->minor] != NULL);
|
|
|
+ video_device[vdev->minor] = vdev;
|
|
|
vdev->index = get_index(vdev);
|
|
|
mutex_unlock(&videodev_lock);
|
|
|
|
|
@@ -930,9 +931,6 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
|
|
|
#endif
|
|
|
/* Part 6: Activate this minor. The char device can now be used. */
|
|
|
set_bit(V4L2_FL_REGISTERED, &vdev->flags);
|
|
|
- mutex_lock(&videodev_lock);
|
|
|
- video_device[vdev->minor] = vdev;
|
|
|
- mutex_unlock(&videodev_lock);
|
|
|
|
|
|
return 0;
|
|
|
|
|
@@ -940,6 +938,7 @@ cleanup:
|
|
|
mutex_lock(&videodev_lock);
|
|
|
if (vdev->cdev)
|
|
|
cdev_del(vdev->cdev);
|
|
|
+ video_device[vdev->minor] = NULL;
|
|
|
devnode_clear(vdev);
|
|
|
mutex_unlock(&videodev_lock);
|
|
|
/* Mark this video device as never having been registered. */
|