diff options
Diffstat (limited to 'drivers/media/video/videodev.c')
-rw-r--r-- | drivers/media/video/videodev.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index b26ebaff226f..0fc90cd393f6 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -760,7 +760,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
760 | ret=vfd->vidioc_overlay(file, fh, *i); | 760 | ret=vfd->vidioc_overlay(file, fh, *i); |
761 | break; | 761 | break; |
762 | } | 762 | } |
763 | #ifdef HAVE_V4L1 | 763 | #ifdef CONFIG_V4L1_COMPAT |
764 | /* --- streaming capture ------------------------------------- */ | 764 | /* --- streaming capture ------------------------------------- */ |
765 | case VIDIOCGMBUF: | 765 | case VIDIOCGMBUF: |
766 | { | 766 | { |
@@ -1512,6 +1512,7 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1512 | int i=0; | 1512 | int i=0; |
1513 | int base; | 1513 | int base; |
1514 | int end; | 1514 | int end; |
1515 | int ret; | ||
1515 | char *name_base; | 1516 | char *name_base; |
1516 | 1517 | ||
1517 | switch(type) | 1518 | switch(type) |
@@ -1537,6 +1538,8 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1537 | name_base = "radio"; | 1538 | name_base = "radio"; |
1538 | break; | 1539 | break; |
1539 | default: | 1540 | default: |
1541 | printk(KERN_ERR "%s called with unknown type: %d\n", | ||
1542 | __FUNCTION__, type); | ||
1540 | return -1; | 1543 | return -1; |
1541 | } | 1544 | } |
1542 | 1545 | ||
@@ -1571,9 +1574,18 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1571 | vfd->class_dev.class = &video_class; | 1574 | vfd->class_dev.class = &video_class; |
1572 | vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); | 1575 | vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); |
1573 | sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); | 1576 | sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); |
1574 | class_device_register(&vfd->class_dev); | 1577 | ret = class_device_register(&vfd->class_dev); |
1575 | class_device_create_file(&vfd->class_dev, | 1578 | if (ret < 0) { |
1576 | &class_device_attr_name); | 1579 | printk(KERN_ERR "%s: class_device_register failed\n", |
1580 | __FUNCTION__); | ||
1581 | goto fail_minor; | ||
1582 | } | ||
1583 | ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name); | ||
1584 | if (ret < 0) { | ||
1585 | printk(KERN_ERR "%s: class_device_create_file 'name' failed\n", | ||
1586 | __FUNCTION__); | ||
1587 | goto fail_classdev; | ||
1588 | } | ||
1577 | 1589 | ||
1578 | #if 1 | 1590 | #if 1 |
1579 | /* needed until all drivers are fixed */ | 1591 | /* needed until all drivers are fixed */ |
@@ -1583,6 +1595,15 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1583 | "http://lwn.net/Articles/36850/\n", vfd->name); | 1595 | "http://lwn.net/Articles/36850/\n", vfd->name); |
1584 | #endif | 1596 | #endif |
1585 | return 0; | 1597 | return 0; |
1598 | |||
1599 | fail_classdev: | ||
1600 | class_device_unregister(&vfd->class_dev); | ||
1601 | fail_minor: | ||
1602 | mutex_lock(&videodev_lock); | ||
1603 | video_device[vfd->minor] = NULL; | ||
1604 | vfd->minor = -1; | ||
1605 | mutex_unlock(&videodev_lock); | ||
1606 | return ret; | ||
1586 | } | 1607 | } |
1587 | 1608 | ||
1588 | /** | 1609 | /** |