From 6a08e4d1f06580b112a2e493d69cbd65be8f50b3 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Tue, 25 Jul 2006 09:32:31 -0300 Subject: bttv: use class_device_create_file and handle errors From: Trent Piepho 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 --- linux/drivers/media/video/bt8xx/bttv-driver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index da7fab7aa..b0342f583 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -3957,8 +3957,12 @@ static int __devinit bttv_register_video(struct bttv *btv) printk(KERN_INFO "bttv%d: registered device video%d\n", btv->c.nr,btv->video_dev->minor & 0x1f); #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - - 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; + } #endif /* vbi */ -- cgit v1.2.3