diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-11-15 03:49:56 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-15 20:20:58 -0500 |
commit | 191c5f10275cfbb36802edadbdb10c73537327b4 (patch) | |
tree | 93e6f0d57cb1295fb7c461dbe5ecefafeb4ad15a /drivers/tty/nozomi.c | |
parent | d0f59141ca40159c9d142c0f62e9aea61f846539 (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/tty/nozomi.c')
-rw-r--r-- | drivers/tty/nozomi.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index b917c9424954..cb764d297756 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c | |||
@@ -1479,6 +1479,7 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev, | |||
1479 | if (IS_ERR(tty_dev)) { | 1479 | if (IS_ERR(tty_dev)) { |
1480 | ret = PTR_ERR(tty_dev); | 1480 | ret = PTR_ERR(tty_dev); |
1481 | dev_err(&pdev->dev, "Could not allocate tty?\n"); | 1481 | dev_err(&pdev->dev, "Could not allocate tty?\n"); |
1482 | tty_port_destroy(&port->port); | ||
1482 | goto err_free_tty; | 1483 | goto err_free_tty; |
1483 | } | 1484 | } |
1484 | } | 1485 | } |
@@ -1486,8 +1487,10 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev, | |||
1486 | return 0; | 1487 | return 0; |
1487 | 1488 | ||
1488 | err_free_tty: | 1489 | err_free_tty: |
1489 | for (i = dc->index_start; i < dc->index_start + MAX_PORT; ++i) | 1490 | for (i = 0; i < MAX_PORT; ++i) { |
1490 | tty_unregister_device(ntty_driver, i); | 1491 | tty_unregister_device(ntty_driver, dc->index_start + i); |
1492 | tty_port_destroy(&dc->port[i].port); | ||
1493 | } | ||
1491 | err_free_kfifo: | 1494 | err_free_kfifo: |
1492 | for (i = 0; i < MAX_PORT; i++) | 1495 | for (i = 0; i < MAX_PORT; i++) |
1493 | kfifo_free(&dc->port[i].fifo_ul); | 1496 | kfifo_free(&dc->port[i].fifo_ul); |
@@ -1520,8 +1523,10 @@ static void __devexit tty_exit(struct nozomi *dc) | |||
1520 | complete off a hangup method ? */ | 1523 | complete off a hangup method ? */ |
1521 | while (dc->open_ttys) | 1524 | while (dc->open_ttys) |
1522 | msleep(1); | 1525 | msleep(1); |
1523 | for (i = dc->index_start; i < dc->index_start + MAX_PORT; ++i) | 1526 | for (i = 0; i < MAX_PORT; ++i) { |
1524 | tty_unregister_device(ntty_driver, i); | 1527 | tty_unregister_device(ntty_driver, dc->index_start + i); |
1528 | tty_port_destroy(&dc->port[i].port); | ||
1529 | } | ||
1525 | } | 1530 | } |
1526 | 1531 | ||
1527 | /* Deallocate memory for one device */ | 1532 | /* Deallocate memory for one device */ |