aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-11-15 03:49:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-15 20:20:58 -0500
commit191c5f10275cfbb36802edadbdb10c73537327b4 (patch)
tree93e6f0d57cb1295fb7c461dbe5ecefafeb4ad15a /drivers/isdn
parentd0f59141ca40159c9d142c0f62e9aea61f846539 (diff)
TTY: call tty_port_destroy in the rest of drivers
After commit "TTY: move tty buffers to tty_port", the tty buffers are not freed in some drivers. This is because tty_port_destructor is not called whenever a tty_port is freed. This was an assumption I counted with but was unfortunately untrue. So fix the drivers to fulfil this assumption. To be sure, the TTY buffers (and later some stuff) are gone along with the tty_port, we have to call tty_port_destroy at tear-down places. This is mostly where the structure containing a tty_port is freed. This patch does exactly that -- put tty_port_destroy at those places. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/gigaset/common.c10
-rw-r--r--drivers/isdn/i4l/isdn_tty.c4
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 30a6b174fbb0..bc9d89a8c4f6 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -518,6 +518,7 @@ f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]");
518 kfree(cs->bcs); 518 kfree(cs->bcs);
519f_cs: gig_dbg(DEBUG_INIT, "freeing cs"); 519f_cs: gig_dbg(DEBUG_INIT, "freeing cs");
520 mutex_unlock(&cs->mutex); 520 mutex_unlock(&cs->mutex);
521 tty_port_destroy(&cs->port);
521 free_cs(cs); 522 free_cs(cs);
522} 523}
523EXPORT_SYMBOL_GPL(gigaset_freecs); 524EXPORT_SYMBOL_GPL(gigaset_freecs);
@@ -751,14 +752,14 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
751 gig_dbg(DEBUG_INIT, "setting up iif"); 752 gig_dbg(DEBUG_INIT, "setting up iif");
752 if (gigaset_isdn_regdev(cs, modulename) < 0) { 753 if (gigaset_isdn_regdev(cs, modulename) < 0) {
753 pr_err("error registering ISDN device\n"); 754 pr_err("error registering ISDN device\n");
754 goto error; 755 goto error_port;
755 } 756 }
756 757
757 make_valid(cs, VALID_ID); 758 make_valid(cs, VALID_ID);
758 ++cs->cs_init; 759 ++cs->cs_init;
759 gig_dbg(DEBUG_INIT, "setting up hw"); 760 gig_dbg(DEBUG_INIT, "setting up hw");
760 if (cs->ops->initcshw(cs) < 0) 761 if (cs->ops->initcshw(cs) < 0)
761 goto error; 762 goto error_port;
762 763
763 ++cs->cs_init; 764 ++cs->cs_init;
764 765
@@ -773,7 +774,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
773 gig_dbg(DEBUG_INIT, "setting up bcs[%d]", i); 774 gig_dbg(DEBUG_INIT, "setting up bcs[%d]", i);
774 if (gigaset_initbcs(cs->bcs + i, cs, i) < 0) { 775 if (gigaset_initbcs(cs->bcs + i, cs, i) < 0) {
775 pr_err("could not allocate channel %d data\n", i); 776 pr_err("could not allocate channel %d data\n", i);
776 goto error; 777 goto error_port;
777 } 778 }
778 } 779 }
779 780
@@ -786,7 +787,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
786 787
787 gig_dbg(DEBUG_INIT, "cs initialized"); 788 gig_dbg(DEBUG_INIT, "cs initialized");
788 return cs; 789 return cs;
789 790error_port:
791 tty_port_destroy(&cs->port);
790error: 792error:
791 gig_dbg(DEBUG_INIT, "failed"); 793 gig_dbg(DEBUG_INIT, "failed");
792 gigaset_freecs(cs); 794 gigaset_freecs(cs);
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index b817809f763c..e09dc8a5e743 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -1849,6 +1849,8 @@ err_unregister:
1849 kfree(info->fax); 1849 kfree(info->fax);
1850#endif 1850#endif
1851 kfree(info->port.xmit_buf - 4); 1851 kfree(info->port.xmit_buf - 4);
1852 info->port.xmit_buf = NULL;
1853 tty_port_destroy(&info->port);
1852 } 1854 }
1853 tty_unregister_driver(m->tty_modem); 1855 tty_unregister_driver(m->tty_modem);
1854err: 1856err:
@@ -1870,6 +1872,8 @@ isdn_tty_exit(void)
1870 kfree(info->fax); 1872 kfree(info->fax);
1871#endif 1873#endif
1872 kfree(info->port.xmit_buf - 4); 1874 kfree(info->port.xmit_buf - 4);
1875 info->port.xmit_buf = NULL;
1876 tty_port_destroy(&info->port);
1873 } 1877 }
1874 tty_unregister_driver(dev->mdm.tty_modem); 1878 tty_unregister_driver(dev->mdm.tty_modem);
1875 put_tty_driver(dev->mdm.tty_modem); 1879 put_tty_driver(dev->mdm.tty_modem);