|
@@ -939,10 +939,14 @@ int __video_register_device(struct video_device *vdev,
|
|
#endif
|
|
#endif
|
|
vdev->minor = i + minor_offset;
|
|
vdev->minor = i + minor_offset;
|
|
vdev->num = nr;
|
|
vdev->num = nr;
|
|
- devnode_set(vdev);
|
|
|
|
|
|
|
|
/* Should not happen since we thought this minor was free */
|
|
/* Should not happen since we thought this minor was free */
|
|
- WARN_ON(video_device[vdev->minor] != NULL);
|
|
|
|
|
|
+ if (WARN_ON(video_device[vdev->minor])) {
|
|
|
|
+ mutex_unlock(&videodev_lock);
|
|
|
|
+ printk(KERN_ERR "video_device not empty!\n");
|
|
|
|
+ return -ENFILE;
|
|
|
|
+ }
|
|
|
|
+ devnode_set(vdev);
|
|
vdev->index = get_index(vdev);
|
|
vdev->index = get_index(vdev);
|
|
video_device[vdev->minor] = vdev;
|
|
video_device[vdev->minor] = vdev;
|
|
mutex_unlock(&videodev_lock);
|
|
mutex_unlock(&videodev_lock);
|