diff options
author | Kirill Smelkov <kirr@mns.spb.ru> | 2005-11-07 08:59:22 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 15:53:36 (GMT) |
commit | 64698b694db96b8db6f379de7d2040f61c6fc7bf (patch) | |
tree | 06f3ed29fc2971f0861feb9b6474474a6a31d508 /drivers/char | |
parent | 57432345b644ef92dcd0a378db6bc40ab0e7f314 (diff) | |
download | linux-64698b694db96b8db6f379de7d2040f61c6fc7bf.tar.xz |
[PATCH] serial moxa: fix leaks of struct tty_driver
Fix leak of struct tty_driver in mxser_init & mxser_module_exit
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/mxser.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 4b783d9..d5c34af 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -494,14 +494,18 @@ static int __init mxser_module_init(void) static void __exit mxser_module_exit(void) { - int i, err = 0; + int i, err; if (verbose) printk(KERN_DEBUG "Unloading module mxser ...\n"); - if ((err |= tty_unregister_driver(mxvar_sdriver))) + err = tty_unregister_driver(mxvar_sdriver); + if (!err) + put_tty_driver(mxvar_sdriver); + else printk(KERN_ERR "Couldn't unregister MOXA Smartio/Industio family serial driver\n"); + for (i = 0; i < MXSER_BOARDS; i++) { struct pci_dev *pdev; @@ -690,7 +694,6 @@ static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxs static int mxser_init(void) { int i, m, retval, b, n; - int ret1; struct pci_dev *pdev = NULL; int index; unsigned char busnum, devnum; @@ -854,14 +857,11 @@ static int mxser_init(void) } #endif - ret1 = 0; - if (!(ret1 = tty_register_driver(mxvar_sdriver))) { - return 0; - } else + retval = tty_register_driver(mxvar_sdriver); + if (retval) { printk(KERN_ERR "Couldn't install MOXA Smartio/Industio family driver !\n"); + put_tty_driver(mxvar_sdriver); - - if (ret1) { for (i = 0; i < MXSER_BOARDS; i++) { if (mxsercfg[i].board_type == -1) continue; @@ -870,10 +870,10 @@ static int mxser_init(void) //todo: release io, vector } } - return -1; + return retval; } - return (0); + return 0; } static void mxser_do_softint(void *private_) |