]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/media/v4l2-core/v4l2-dev.c
Merge tag 'sound-fix2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[karo-tx-linux.git] / drivers / media / v4l2-core / v4l2-dev.c
index b0f49b014bc59cb5a581566a117994c26b4106a6..b5aaaac427add9180221b4bd19fe88133e6bc212 100644 (file)
@@ -872,6 +872,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);
 
@@ -934,9 +935,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;
 
@@ -944,6 +942,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. */