aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/cyclades.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 1fe0bb6c7ad7..970d99a69a2b 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -5460,10 +5460,11 @@ static const struct tty_operations cy_ops = {
5460static int __init cy_init(void) 5460static int __init cy_init(void)
5461{ 5461{
5462 unsigned int i, nboards; 5462 unsigned int i, nboards;
5463 int retval = -ENOMEM;
5463 5464
5464 cy_serial_driver = alloc_tty_driver(NR_PORTS); 5465 cy_serial_driver = alloc_tty_driver(NR_PORTS);
5465 if (!cy_serial_driver) 5466 if (!cy_serial_driver)
5466 return -ENOMEM; 5467 goto err;
5467 show_version(); 5468 show_version();
5468 5469
5469 /* Initialize the tty_driver structure */ 5470 /* Initialize the tty_driver structure */
@@ -5481,8 +5482,11 @@ static int __init cy_init(void)
5481 cy_serial_driver->flags = TTY_DRIVER_REAL_RAW; 5482 cy_serial_driver->flags = TTY_DRIVER_REAL_RAW;
5482 tty_set_operations(cy_serial_driver, &cy_ops); 5483 tty_set_operations(cy_serial_driver, &cy_ops);
5483 5484
5484 if (tty_register_driver(cy_serial_driver)) 5485 retval = tty_register_driver(cy_serial_driver);
5485 panic("Couldn't register Cyclades serial driver\n"); 5486 if (retval) {
5487 printk(KERN_ERR "Couldn't register Cyclades serial driver\n");
5488 goto err_frtty;
5489 }
5486 5490
5487 for (i = 0; i < NR_CARDS; i++) { 5491 for (i = 0; i < NR_CARDS; i++) {
5488 /* base_addr=0 indicates board not found */ 5492 /* base_addr=0 indicates board not found */
@@ -5508,7 +5512,18 @@ static int __init cy_init(void)
5508 /* look for pci boards */ 5512 /* look for pci boards */
5509 nboards += cy_detect_pci(); 5513 nboards += cy_detect_pci();
5510 5514
5511 return nboards ? 0 : -ENODEV; 5515 if (nboards == 0) {
5516 retval = -ENODEV;
5517 goto err_unr;
5518 }
5519
5520 return 0;
5521err_unr:
5522 tty_unregister_driver(cy_serial_driver);
5523err_frtty:
5524 put_tty_driver(cy_serial_driver);
5525err:
5526 return retval;
5512} /* cy_init */ 5527} /* cy_init */
5513 5528
5514static void __exit cy_cleanup_module(void) 5529static void __exit cy_cleanup_module(void)