aboutsummaryrefslogtreecommitdiff
path: root/drivers/isdn
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@web.de>2010-02-08 10:12:24 +0000
committerDavid S. Miller <davem@davemloft.net>2010-02-16 16:01:26 -0800
commite76b1544074b5fc7983a21fb1f51a7faf03d3179 (patch)
treebbea37776ed94f4dbc9eb5cfb2bdb772d33e8611 /drivers/isdn
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')
-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 46f85ae85f5..c22b34976c2 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1307,10 +1307,11 @@ static const struct tty_operations capinc_ops = {
.send_xchar = capinc_tty_send_xchar,
};
-static int capinc_tty_init(void)
+static int __init capinc_tty_init(void)
{
struct tty_driver *drv;
-
+ int err;
+
if (capi_ttyminors > CAPINC_MAX_PORTS)
capi_ttyminors = CAPINC_MAX_PORTS;
if (capi_ttyminors <= 0)
@@ -1340,23 +1341,22 @@ static int capinc_tty_init(void)
drv->init_termios.c_lflag = 0;
drv->flags = TTY_DRIVER_REAL_RAW|TTY_DRIVER_RESET_TERMIOS;
tty_set_operations(drv, &capinc_ops);
- if (tty_register_driver(drv)) {
+
+ err = tty_register_driver(drv);
+ if (err) {
put_tty_driver(drv);
kfree(capiminors);
printk(KERN_ERR "Couldn't register capi_nc driver\n");
- return -1;
+ return err;
}
capinc_tty_driver = drv;
return 0;
}
-static void capinc_tty_exit(void)
+static void __exit capinc_tty_exit(void)
{
- struct tty_driver *drv = capinc_tty_driver;
- int retval;
- if ((retval = tty_unregister_driver(drv)))
- printk(KERN_ERR "capi: failed to unregister capi_nc driver (%d)\n", retval);
- put_tty_driver(drv);
+ tty_unregister_driver(capinc_tty_driver);
+ put_tty_driver(capinc_tty_driver);
kfree(capiminors);
}