aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/mxser.c
diff options
context:
space:
mode:
authorKirill Smelkov <kirr@mns.spb.ru>2005-11-07 03:59:22 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:36 -0500
commit64698b694db96b8db6f379de7d2040f61c6fc7bf (patch)
tree06f3ed29fc2971f0861feb9b6474474a6a31d508 /drivers/char/mxser.c
parent57432345b644ef92dcd0a378db6bc40ab0e7f314 (diff)
[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/mxser.c')
-rw-r--r--drivers/char/mxser.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 4b783d9bbd59..d5c34af8752d 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -494,14 +494,18 @@ static int __init mxser_module_init(void)
494 494
495static void __exit mxser_module_exit(void) 495static void __exit mxser_module_exit(void)
496{ 496{
497 int i, err = 0; 497 int i, err;
498 498
499 if (verbose) 499 if (verbose)
500 printk(KERN_DEBUG "Unloading module mxser ...\n"); 500 printk(KERN_DEBUG "Unloading module mxser ...\n");
501 501
502 if ((err |= tty_unregister_driver(mxvar_sdriver))) 502 err = tty_unregister_driver(mxvar_sdriver);
503 if (!err)
504 put_tty_driver(mxvar_sdriver);
505 else
503 printk(KERN_ERR "Couldn't unregister MOXA Smartio/Industio family serial driver\n"); 506 printk(KERN_ERR "Couldn't unregister MOXA Smartio/Industio family serial driver\n");
504 507
508
505 for (i = 0; i < MXSER_BOARDS; i++) { 509 for (i = 0; i < MXSER_BOARDS; i++) {
506 struct pci_dev *pdev; 510 struct pci_dev *pdev;
507 511
@@ -690,7 +694,6 @@ static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxs
690static int mxser_init(void) 694static int mxser_init(void)
691{ 695{
692 int i, m, retval, b, n; 696 int i, m, retval, b, n;
693 int ret1;
694 struct pci_dev *pdev = NULL; 697 struct pci_dev *pdev = NULL;
695 int index; 698 int index;
696 unsigned char busnum, devnum; 699 unsigned char busnum, devnum;
@@ -854,14 +857,11 @@ static int mxser_init(void)
854 } 857 }
855#endif 858#endif
856 859
857 ret1 = 0; 860 retval = tty_register_driver(mxvar_sdriver);
858 if (!(ret1 = tty_register_driver(mxvar_sdriver))) { 861 if (retval) {
859 return 0;
860 } else
861 printk(KERN_ERR "Couldn't install MOXA Smartio/Industio family driver !\n"); 862 printk(KERN_ERR "Couldn't install MOXA Smartio/Industio family driver !\n");
863 put_tty_driver(mxvar_sdriver);
862 864
863
864 if (ret1) {
865 for (i = 0; i < MXSER_BOARDS; i++) { 865 for (i = 0; i < MXSER_BOARDS; i++) {
866 if (mxsercfg[i].board_type == -1) 866 if (mxsercfg[i].board_type == -1)
867 continue; 867 continue;
@@ -870,10 +870,10 @@ static int mxser_init(void)
870 //todo: release io, vector 870 //todo: release io, vector
871 } 871 }
872 } 872 }
873 return -1; 873 return retval;
874 } 874 }
875 875
876 return (0); 876 return 0;
877} 877}
878 878
879static void mxser_do_softint(void *private_) 879static void mxser_do_softint(void *private_)