According to the comment of tty_port_destroy():
    When a port was initialized using tty_port_init, one has to destroy
    the port by tty_port_destroy();

tty_port_init() is called in gsm_dlci_alloc()
so tty_port_destroy() needs to be called in gsm_dlci_free()

Signed-off-by: Xiaoming Ni <nixiaom...@huawei.com>
---
 drivers/tty/n_gsm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 36a3eb4..3f5bcc9 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1681,6 +1681,7 @@ static void gsm_dlci_free(struct tty_port *port)
 
        del_timer_sync(&dlci->t1);
        dlci->gsm->dlci[dlci->addr] = NULL;
+       tty_port_destroy(&dlci->port);
        kfifo_free(dlci->fifo);
        while ((dlci->skb = skb_dequeue(&dlci->skb_list)))
                dev_kfree_skb(dlci->skb);
-- 
1.8.5.6

Reply via email to