Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d94fc9a0 authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (4368): Bttv: use class_device_create_file and handle errors



Revert bttv-driver.c from video_device_create_file() to use
class_device_create_file() again.  video_device_create_file() is only
available when V4L1 is on.
Proper error checking is added for failure of class_device_create_file().
Will print error message and unroll partially created sysfs entries.

Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 53dd8def
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3923,8 +3923,12 @@ 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);

	video_device_create_file(btv->video_dev, &class_device_attr_card);
	if (class_device_create_file(&btv->video_dev->class_dev,
				     &class_device_attr_card)<0) {
		printk(KERN_ERR "bttv%d: class_device_create_file 'card' "
		       "failed\n", btv->c.nr);
		goto err;
	}

	/* vbi */
	btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi");
+4 −3
Original line number Diff line number Diff line
@@ -1578,12 +1578,13 @@ int video_register_device(struct video_device *vfd, int type, int nr)
	if (ret) {
		printk(KERN_ERR "%s: class_device_register failed\n",
		       __FUNCTION__);
		return ret;
		goto fail_minor;
	}
	ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name);
	if (ret < 0) {
		printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret);
		return ret;
		printk(KERN_ERR "%s: class_device_create_file 'name' failed\n",
		       __FUNCTION__);
		goto fail_classdev;
	}

#if 1