/* 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 {
                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");
 
 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));
        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);
 }
 
 
 {
        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);
 
        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
 
        int i=0;
        int base;
        int end;
+       int ret;
        char *name_base;
 
        switch(type)
        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 */
 
 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,