diff options
Diffstat (limited to 'drivers/char/misc.c')
-rw-r--r-- | drivers/char/misc.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 4d058dadbfcc..eaace0db0ff4 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -263,23 +263,26 @@ EXPORT_SYMBOL(misc_deregister); | |||
263 | 263 | ||
264 | static int __init misc_init(void) | 264 | static int __init misc_init(void) |
265 | { | 265 | { |
266 | #ifdef CONFIG_PROC_FS | 266 | int err; |
267 | struct proc_dir_entry *ent; | ||
268 | 267 | ||
269 | ent = create_proc_entry("misc", 0, NULL); | 268 | #ifdef CONFIG_PROC_FS |
270 | if (ent) | 269 | proc_create("misc", 0, NULL, &misc_proc_fops); |
271 | ent->proc_fops = &misc_proc_fops; | ||
272 | #endif | 270 | #endif |
273 | misc_class = class_create(THIS_MODULE, "misc"); | 271 | misc_class = class_create(THIS_MODULE, "misc"); |
272 | err = PTR_ERR(misc_class); | ||
274 | if (IS_ERR(misc_class)) | 273 | if (IS_ERR(misc_class)) |
275 | return PTR_ERR(misc_class); | 274 | goto fail_remove; |
276 | 275 | ||
277 | if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { | 276 | err = -EIO; |
278 | printk("unable to get major %d for misc devices\n", | 277 | if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) |
279 | MISC_MAJOR); | 278 | goto fail_printk; |
280 | class_destroy(misc_class); | ||
281 | return -EIO; | ||
282 | } | ||
283 | return 0; | 279 | return 0; |
280 | |||
281 | fail_printk: | ||
282 | printk("unable to get major %d for misc devices\n", MISC_MAJOR); | ||
283 | class_destroy(misc_class); | ||
284 | fail_remove: | ||
285 | remove_proc_entry("misc", NULL); | ||
286 | return err; | ||
284 | } | 287 | } |
285 | subsys_initcall(misc_init); | 288 | subsys_initcall(misc_init); |