From 50f029d83c725624378b16f9dd6467a424f166ed Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Sun, 22 Jun 2008 13:10:28 +0000 Subject: Slightly better error hadling: if we failed to register a major device type, don't create pointless files in /sys that will oops on remove. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@4446 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index feb1f53..f9c011d 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -7643,17 +7643,17 @@ static int __init dahdi_init(void) { proc_entries[0] = proc_mkdir("dahdi", NULL); #endif + if ((res = register_chrdev(DAHDI_MAJOR, "dahdi", &dahdi_fops))) { + module_printk(KERN_ERR, "Unable to register DAHDI character device handler on %d\n", DAHDI_MAJOR); + return res; + } + dahdi_class = class_create(THIS_MODULE, "dahdi"); CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 253), NULL, "dahditimer"); CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 254), NULL, "dahdichannel"); CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 255), NULL, "dahdipseudo"); CLASS_DEV_CREATE(dahdi_class, MKDEV(DAHDI_MAJOR, 0), NULL, "dahdictl"); - if ((res = register_chrdev(DAHDI_MAJOR, "dahdi", &dahdi_fops))) { - module_printk(KERN_ERR, "Unable to register DAHDI character device handler on %d\n", DAHDI_MAJOR); - return res; - } - module_printk(KERN_INFO, "Telephony Interface Registered on major %d\n", DAHDI_MAJOR); module_printk(KERN_INFO, "Version: %s\n", DAHDI_VERSION); dahdi_conv_init(); -- cgit v1.2.3