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>
This commit is contained in:
parent
d9cd2d9b61
commit
3117beec7e
@ -3909,8 +3909,6 @@ static void bttv_unregister_video(struct bttv *btv)
|
||||
/* register video4linux devices */
|
||||
static int __devinit bttv_register_video(struct bttv *btv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (no_overlay <= 0) {
|
||||
bttv_video_template.type |= VID_TYPE_OVERLAY;
|
||||
} else {
|
||||
@ -3925,10 +3923,8 @@ static int __devinit bttv_register_video(struct bttv *btv)
|
||||
goto err;
|
||||
printk(KERN_INFO "bttv%d: registered device video%d\n",
|
||||
btv->c.nr,btv->video_dev->minor & 0x1f);
|
||||
ret = video_device_create_file(btv->video_dev, &class_device_attr_card);
|
||||
if (ret < 0)
|
||||
printk(KERN_WARNING "bttv: video_device_create_file error: "
|
||||
"%d\n", ret);
|
||||
|
||||
video_device_create_file(btv->video_dev, &class_device_attr_card);
|
||||
|
||||
/* vbi */
|
||||
btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi");
|
||||
|
@ -600,6 +600,8 @@ static ssize_t debugcmd_store(struct class_device *,const char *,size_t count);
|
||||
static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp)
|
||||
{
|
||||
struct pvr2_sysfs_debugifc *dip;
|
||||
int ret;
|
||||
|
||||
dip = kmalloc(sizeof(*dip),GFP_KERNEL);
|
||||
if (!dip) return;
|
||||
memset(dip,0,sizeof(*dip));
|
||||
@ -613,8 +615,14 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp)
|
||||
dip->attr_debuginfo.attr.mode = S_IRUGO;
|
||||
dip->attr_debuginfo.show = debuginfo_show;
|
||||
sfp->debugifc = dip;
|
||||
class_device_create_file(sfp->class_dev,&dip->attr_debugcmd);
|
||||
class_device_create_file(sfp->class_dev,&dip->attr_debuginfo);
|
||||
ret = class_device_create_file(sfp->class_dev,&dip->attr_debugcmd);
|
||||
if (ret < 0)
|
||||
printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
|
||||
__FUNCTION__, ret);
|
||||
ret = class_device_create_file(sfp->class_dev,&dip->attr_debuginfo);
|
||||
if (ret < 0)
|
||||
printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
|
||||
__FUNCTION__, ret);
|
||||
}
|
||||
|
||||
|
||||
@ -709,6 +717,8 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
|
||||
{
|
||||
struct usb_device *usb_dev;
|
||||
struct class_device *class_dev;
|
||||
int ret;
|
||||
|
||||
usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw);
|
||||
if (!usb_dev) return;
|
||||
class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL);
|
||||
@ -733,20 +743,33 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
|
||||
|
||||
sfp->class_dev = class_dev;
|
||||
class_dev->class_data = sfp;
|
||||
class_device_register(class_dev);
|
||||
ret = class_device_register(class_dev);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "%s: class_device_register failed\n",
|
||||
__FUNCTION__);
|
||||
kfree(class_dev);
|
||||
return;
|
||||
}
|
||||
|
||||
sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE;
|
||||
sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number";
|
||||
sfp->attr_v4l_minor_number.attr.mode = S_IRUGO;
|
||||
sfp->attr_v4l_minor_number.show = v4l_minor_number_show;
|
||||
sfp->attr_v4l_minor_number.store = NULL;
|
||||
class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number);
|
||||
ret = class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number);
|
||||
if (ret < 0)
|
||||
printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
|
||||
__FUNCTION__, ret);
|
||||
|
||||
sfp->attr_unit_number.attr.owner = THIS_MODULE;
|
||||
sfp->attr_unit_number.attr.name = "unit_number";
|
||||
sfp->attr_unit_number.attr.mode = S_IRUGO;
|
||||
sfp->attr_unit_number.show = unit_number_show;
|
||||
sfp->attr_unit_number.store = NULL;
|
||||
class_device_create_file(sfp->class_dev,&sfp->attr_unit_number);
|
||||
ret = class_device_create_file(sfp->class_dev,&sfp->attr_unit_number);
|
||||
if (ret < 0)
|
||||
printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
|
||||
__FUNCTION__, ret);
|
||||
|
||||
pvr2_sysfs_add_controls(sfp);
|
||||
#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
|
||||
|
@ -1512,6 +1512,7 @@ int video_register_device(struct video_device *vfd, int type, int nr)
|
||||
int i=0;
|
||||
int base;
|
||||
int end;
|
||||
int ret;
|
||||
char *name_base;
|
||||
|
||||
switch(type)
|
||||
@ -1571,9 +1572,13 @@ int video_register_device(struct video_device *vfd, int type, int nr)
|
||||
vfd->class_dev.class = &video_class;
|
||||
vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
|
||||
sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base);
|
||||
class_device_register(&vfd->class_dev);
|
||||
class_device_create_file(&vfd->class_dev,
|
||||
&class_device_attr_name);
|
||||
ret = class_device_register(&vfd->class_dev);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "%s: class_device_register failed\n",
|
||||
__FUNCTION__);
|
||||
return ret;
|
||||
}
|
||||
video_device_create_file(vfd, &class_device_attr_name);
|
||||
|
||||
#if 1
|
||||
/* needed until all drivers are fixed */
|
||||
|
@ -341,11 +341,14 @@ extern int video_usercopy(struct inode *inode, struct file *file,
|
||||
extern struct video_device* video_devdata(struct file*);
|
||||
|
||||
#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
|
||||
static inline void
|
||||
static inline int
|
||||
video_device_create_file(struct video_device *vfd,
|
||||
struct class_device_attribute *attr)
|
||||
{
|
||||
class_device_create_file(&vfd->class_dev, attr);
|
||||
int ret = class_device_create_file(&vfd->class_dev, attr);
|
||||
if (ret < 0)
|
||||
printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret);
|
||||
return ret;
|
||||
}
|
||||
static inline void
|
||||
video_device_remove_file(struct video_device *vfd,
|
||||
|
Loading…
Reference in New Issue
Block a user