aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/capi/capi.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@web.de>2010-02-08 05:12:24 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-16 19:01:26 -0500
commite76b1544074b5fc7983a21fb1f51a7faf03d3179 (patch)
treebbea37776ed94f4dbc9eb5cfb2bdb772d33e8611 /drivers/isdn/capi/capi.c
parent81d17fe5e29d863027824928e1c336baa9abfee9 (diff)
CAPI: Clean up capinc_tty_init/exit
Return proper error code if tty_register_driver fails. In contrast, tty_unregister_driver cannot practically fail, so drop that error handling. Finally, mark capinc_tty_init/exit with __init/__exit. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/capi/capi.c')
-rw-r--r--drivers/isdn/capi/capi.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 46f85ae85f5f..c22b34976c24 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1307,10 +1307,11 @@ static const struct tty_operations capinc_ops = {
1307 .send_xchar = capinc_tty_send_xchar, 1307 .send_xchar = capinc_tty_send_xchar,
1308}; 1308};
1309 1309
1310static int capinc_tty_init(void) 1310static int __init capinc_tty_init(void)
1311{ 1311{
1312 struct tty_driver *drv; 1312 struct tty_driver *drv;
1313 1313 int err;
1314
1314 if (capi_ttyminors > CAPINC_MAX_PORTS) 1315 if (capi_ttyminors > CAPINC_MAX_PORTS)
1315 capi_ttyminors = CAPINC_MAX_PORTS; 1316 capi_ttyminors = CAPINC_MAX_PORTS;
1316 if (capi_ttyminors <= 0) 1317 if (capi_ttyminors <= 0)
@@ -1340,23 +1341,22 @@ static int capinc_tty_init(void)
1340 drv->init_termios.c_lflag = 0; 1341 drv->init_termios.c_lflag = 0;
1341 drv->flags = TTY_DRIVER_REAL_RAW|TTY_DRIVER_RESET_TERMIOS; 1342 drv->flags = TTY_DRIVER_REAL_RAW|TTY_DRIVER_RESET_TERMIOS;
1342 tty_set_operations(drv, &capinc_ops); 1343 tty_set_operations(drv, &capinc_ops);
1343 if (tty_register_driver(drv)) { 1344
1345 err = tty_register_driver(drv);
1346 if (err) {
1344 put_tty_driver(drv); 1347 put_tty_driver(drv);
1345 kfree(capiminors); 1348 kfree(capiminors);
1346 printk(KERN_ERR "Couldn't register capi_nc driver\n"); 1349 printk(KERN_ERR "Couldn't register capi_nc driver\n");
1347 return -1; 1350 return err;
1348 } 1351 }
1349 capinc_tty_driver = drv; 1352 capinc_tty_driver = drv;
1350 return 0; 1353 return 0;
1351} 1354}
1352 1355
1353static void capinc_tty_exit(void) 1356static void __exit capinc_tty_exit(void)
1354{ 1357{
1355 struct tty_driver *drv = capinc_tty_driver; 1358 tty_unregister_driver(capinc_tty_driver);
1356 int retval; 1359 put_tty_driver(capinc_tty_driver);
1357 if ((retval = tty_unregister_driver(drv)))
1358 printk(KERN_ERR "capi: failed to unregister capi_nc driver (%d)\n", retval);
1359 put_tty_driver(drv);
1360 kfree(capiminors); 1360 kfree(capiminors);
1361} 1361}
1362 1362