aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2006-07-19 12:23:38 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-07-29 16:22:21 -0400
commit3117beec7e43f91ce156cacf033a712c7e22737d (patch)
treee661e3bbd6ebcd5537bfb7e526d8bbc55a3b0ebc
parentd9cd2d9b61898354f5dbabdc490dd6ef309ebbd4 (diff)
V4L/DVB (4316): Check __must_check warnings
Check __must_check warnings for class_device_register and class_device_create_file video_device_create_file was declared as a void, but instead should return the int value of class_device_create_file. Move the check from bttv-driver.c into v4l2-dev.h, because all other callers of video_device_create_file must also be checked. Replace the call to class_device_create_file in videodev.c with video_device_create_file, as defined in v4l2-dev.h, so that the return value of class_device_create_file will be checked. Check the return value of class_device_register in videodev.c and pvrusb2-sysfs.c Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c8
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c33
-rw-r--r--drivers/media/video/videodev.c11
-rw-r--r--include/media/v4l2-dev.h7
4 files changed, 43 insertions, 16 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 63e83162286c..6db5e4e73397 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3909,8 +3909,6 @@ static void bttv_unregister_video(struct bttv *btv)
3909/* register video4linux devices */ 3909/* register video4linux devices */
3910static int __devinit bttv_register_video(struct bttv *btv) 3910static int __devinit bttv_register_video(struct bttv *btv)
3911{ 3911{
3912 int ret;
3913
3914 if (no_overlay <= 0) { 3912 if (no_overlay <= 0) {
3915 bttv_video_template.type |= VID_TYPE_OVERLAY; 3913 bttv_video_template.type |= VID_TYPE_OVERLAY;
3916 } else { 3914 } else {
@@ -3925,10 +3923,8 @@ static int __devinit bttv_register_video(struct bttv *btv)
3925 goto err; 3923 goto err;
3926 printk(KERN_INFO "bttv%d: registered device video%d\n", 3924 printk(KERN_INFO "bttv%d: registered device video%d\n",
3927 btv->c.nr,btv->video_dev->minor & 0x1f); 3925 btv->c.nr,btv->video_dev->minor & 0x1f);
3928 ret = video_device_create_file(btv->video_dev, &class_device_attr_card); 3926
3929 if (ret < 0) 3927 video_device_create_file(btv->video_dev, &class_device_attr_card);
3930 printk(KERN_WARNING "bttv: video_device_create_file error: "
3931 "%d\n", ret);
3932 3928
3933 /* vbi */ 3929 /* vbi */
3934 btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); 3930 btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi");
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 6af55a8b6f05..ef46d4f40cff 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -600,6 +600,8 @@ static ssize_t debugcmd_store(struct class_device *,const char *,size_t count);
600static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) 600static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp)
601{ 601{
602 struct pvr2_sysfs_debugifc *dip; 602 struct pvr2_sysfs_debugifc *dip;
603 int ret;
604
603 dip = kmalloc(sizeof(*dip),GFP_KERNEL); 605 dip = kmalloc(sizeof(*dip),GFP_KERNEL);
604 if (!dip) return; 606 if (!dip) return;
605 memset(dip,0,sizeof(*dip)); 607 memset(dip,0,sizeof(*dip));
@@ -613,8 +615,14 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp)
613 dip->attr_debuginfo.attr.mode = S_IRUGO; 615 dip->attr_debuginfo.attr.mode = S_IRUGO;
614 dip->attr_debuginfo.show = debuginfo_show; 616 dip->attr_debuginfo.show = debuginfo_show;
615 sfp->debugifc = dip; 617 sfp->debugifc = dip;
616 class_device_create_file(sfp->class_dev,&dip->attr_debugcmd); 618 ret = class_device_create_file(sfp->class_dev,&dip->attr_debugcmd);
617 class_device_create_file(sfp->class_dev,&dip->attr_debuginfo); 619 if (ret < 0)
620 printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
621 __FUNCTION__, ret);
622 ret = class_device_create_file(sfp->class_dev,&dip->attr_debuginfo);
623 if (ret < 0)
624 printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
625 __FUNCTION__, ret);
618} 626}
619 627
620 628
@@ -709,6 +717,8 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
709{ 717{
710 struct usb_device *usb_dev; 718 struct usb_device *usb_dev;
711 struct class_device *class_dev; 719 struct class_device *class_dev;
720 int ret;
721
712 usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); 722 usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw);
713 if (!usb_dev) return; 723 if (!usb_dev) return;
714 class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL); 724 class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL);
@@ -733,20 +743,33 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
733 743
734 sfp->class_dev = class_dev; 744 sfp->class_dev = class_dev;
735 class_dev->class_data = sfp; 745 class_dev->class_data = sfp;
736 class_device_register(class_dev); 746 ret = class_device_register(class_dev);
747 if (ret) {
748 printk(KERN_ERR "%s: class_device_register failed\n",
749 __FUNCTION__);
750 kfree(class_dev);
751 return;
752 }
737 753
738 sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE; 754 sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE;
739 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; 755 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number";
740 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; 756 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO;
741 sfp->attr_v4l_minor_number.show = v4l_minor_number_show; 757 sfp->attr_v4l_minor_number.show = v4l_minor_number_show;
742 sfp->attr_v4l_minor_number.store = NULL; 758 sfp->attr_v4l_minor_number.store = NULL;
743 class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number); 759 ret = class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number);
760 if (ret < 0)
761 printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
762 __FUNCTION__, ret);
763
744 sfp->attr_unit_number.attr.owner = THIS_MODULE; 764 sfp->attr_unit_number.attr.owner = THIS_MODULE;
745 sfp->attr_unit_number.attr.name = "unit_number"; 765 sfp->attr_unit_number.attr.name = "unit_number";
746 sfp->attr_unit_number.attr.mode = S_IRUGO; 766 sfp->attr_unit_number.attr.mode = S_IRUGO;
747 sfp->attr_unit_number.show = unit_number_show; 767 sfp->attr_unit_number.show = unit_number_show;
748 sfp->attr_unit_number.store = NULL; 768 sfp->attr_unit_number.store = NULL;
749 class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); 769 ret = class_device_create_file(sfp->class_dev,&sfp->attr_unit_number);
770 if (ret < 0)
771 printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
772 __FUNCTION__, ret);
750 773
751 pvr2_sysfs_add_controls(sfp); 774 pvr2_sysfs_add_controls(sfp);
752#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC 775#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index b26ebaff226f..4c3f92605a82 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -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)
@@ -1571,9 +1572,13 @@ int video_register_device(struct video_device *vfd, int type, int nr)
1571 vfd->class_dev.class = &video_class; 1572 vfd->class_dev.class = &video_class;
1572 vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); 1573 vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
1573 sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); 1574 sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base);
1574 class_device_register(&vfd->class_dev); 1575 ret = class_device_register(&vfd->class_dev);
1575 class_device_create_file(&vfd->class_dev, 1576 if (ret) {
1576 &class_device_attr_name); 1577 printk(KERN_ERR "%s: class_device_register failed\n",
1578 __FUNCTION__);
1579 return ret;
1580 }
1581 video_device_create_file(vfd, &class_device_attr_name);
1577 1582
1578#if 1 1583#if 1
1579 /* needed until all drivers are fixed */ 1584 /* needed until all drivers are fixed */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 62dae1a8c441..f8665326ed9f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -341,11 +341,14 @@ extern int video_usercopy(struct inode *inode, struct file *file,
341extern struct video_device* video_devdata(struct file*); 341extern struct video_device* video_devdata(struct file*);
342 342
343#define to_video_device(cd) container_of(cd, struct video_device, class_dev) 343#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
344static inline void 344static inline int
345video_device_create_file(struct video_device *vfd, 345video_device_create_file(struct video_device *vfd,
346 struct class_device_attribute *attr) 346 struct class_device_attribute *attr)
347{ 347{
348 class_device_create_file(&vfd->class_dev, attr); 348 int ret = class_device_create_file(&vfd->class_dev, attr);
349 if (ret < 0)
350 printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret);
351 return ret;
349} 352}
350static inline void 353static inline void
351video_device_remove_file(struct video_device *vfd, 354video_device_remove_file(struct video_device *vfd,