# HG changeset patch # User Trent Piepho # Node ID 092b04007c0f1aa2d3f9b4467ea8ab3837723196 # Parent b900796fdfb4bc87642c470515f88ed7ae92ced3 bttv: use class_device_create_file and handle errors From: Trent Piepho Revery 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 diff -r b900796fdfb4 -r 092b04007c0f linux/drivers/media/video/bt8xx/bttv-driver.c --- a/linux/drivers/media/video/bt8xx/bttv-driver.c Sun Jul 23 19:08:21 2006 -0700 +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c Sun Jul 23 19:10:52 2006 -0700 @@ -3957,8 +3957,12 @@ static int __devinit bttv_register_video 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 */