Commit 252a94e9 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] videodev: handle class_register() failure

From: "Randy.Dunlap" <rddunlap@osdl.org>

From: <WHarms@bfs.de>(Walter Harms)

(acked by Gerd)
parent 19bee149
...@@ -397,12 +397,21 @@ static struct file_operations video_fops= ...@@ -397,12 +397,21 @@ static struct file_operations video_fops=
static int __init videodev_init(void) static int __init videodev_init(void)
{ {
int ret;
printk(KERN_INFO "Linux video capture interface: v1.00\n"); printk(KERN_INFO "Linux video capture interface: v1.00\n");
if (register_chrdev(VIDEO_MAJOR,VIDEO_NAME, &video_fops)) { if (register_chrdev(VIDEO_MAJOR, VIDEO_NAME, &video_fops)) {
printk("video_dev: unable to get major %d\n", VIDEO_MAJOR); printk(KERN_WARNING "video_dev: unable to get major %d\n", VIDEO_MAJOR);
return -EIO;
}
ret = class_register(&video_class);
if (ret < 0) {
unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME);
printk(KERN_WARNING "video_dev: class_register failed\n");
return -EIO; return -EIO;
} }
class_register(&video_class);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment