summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/v4l2-dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/v4l2-dev.c')
-rw-r--r--linux/drivers/media/video/v4l2-dev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/linux/drivers/media/video/v4l2-dev.c b/linux/drivers/media/video/v4l2-dev.c
index 398376a40..a3d52e7f7 100644
--- a/linux/drivers/media/video/v4l2-dev.c
+++ b/linux/drivers/media/video/v4l2-dev.c
@@ -292,6 +292,9 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
int ret;
char *name_base;
+ if (vfd == NULL)
+ return -EINVAL;
+
switch (type) {
case VFL_TYPE_GRABBER:
base = MINOR_VFL_TYPE_GRABBER_MIN;
@@ -316,7 +319,7 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
default:
printk(KERN_ERR "%s called with unknown type: %d\n",
__func__, type);
- return -1;
+ return -EINVAL;
}
/* pick a minor number */
@@ -356,10 +359,8 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
/* sysfs class */
memset(&vfd->dev, 0x00, sizeof(vfd->dev));
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
vfd->dev.class = &video_class;
vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
-#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
if (vfd->parent)
vfd->dev.dev = vfd->parent;