From d94fc9a08e51432d0d5fc0f74a4f705d7b49c251 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sat, 29 Jul 2006 17:18:06 -0300 Subject: 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: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/videodev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/media/video/videodev.c') diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index caa4f736468..46848e2ae47 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c @@ -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 -- cgit v1.2.3