|
@@ -263,23 +263,26 @@ EXPORT_SYMBOL(misc_deregister);
|
|
|
|
|
|
static int __init misc_init(void)
|
|
static int __init misc_init(void)
|
|
{
|
|
{
|
|
-#ifdef CONFIG_PROC_FS
|
|
|
|
- struct proc_dir_entry *ent;
|
|
|
|
|
|
+ int err;
|
|
|
|
|
|
- ent = create_proc_entry("misc", 0, NULL);
|
|
|
|
- if (ent)
|
|
|
|
- ent->proc_fops = &misc_proc_fops;
|
|
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
|
|
+ proc_create("misc", 0, NULL, &misc_proc_fops);
|
|
#endif
|
|
#endif
|
|
misc_class = class_create(THIS_MODULE, "misc");
|
|
misc_class = class_create(THIS_MODULE, "misc");
|
|
|
|
+ err = PTR_ERR(misc_class);
|
|
if (IS_ERR(misc_class))
|
|
if (IS_ERR(misc_class))
|
|
- return PTR_ERR(misc_class);
|
|
|
|
|
|
+ goto fail_remove;
|
|
|
|
|
|
- if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
|
|
|
|
- printk("unable to get major %d for misc devices\n",
|
|
|
|
- MISC_MAJOR);
|
|
|
|
- class_destroy(misc_class);
|
|
|
|
- return -EIO;
|
|
|
|
- }
|
|
|
|
|
|
+ err = -EIO;
|
|
|
|
+ if (register_chrdev(MISC_MAJOR,"misc",&misc_fops))
|
|
|
|
+ goto fail_printk;
|
|
return 0;
|
|
return 0;
|
|
|
|
+
|
|
|
|
+fail_printk:
|
|
|
|
+ printk("unable to get major %d for misc devices\n", MISC_MAJOR);
|
|
|
|
+ class_destroy(misc_class);
|
|
|
|
+fail_remove:
|
|
|
|
+ remove_proc_entry("misc", NULL);
|
|
|
|
+ return err;
|
|
}
|
|
}
|
|
subsys_initcall(misc_init);
|
|
subsys_initcall(misc_init);
|