TTY: call tty_port_destroy in the rest of drivers
[firefly-linux-kernel-4.4.55.git] / drivers / tty / rocket.c
index 9700d34b20a3182794d5f6a4ab5eef8ed050321d..d9056dac4ea18f052fc1737f192bedaa4f6483b0 100644 (file)
@@ -673,6 +673,7 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
        if (sInitChan(ctlp, &info->channel, aiop, chan) == 0) {
                printk(KERN_ERR "RocketPort sInitChan(%d, %d, %d) failed!\n",
                                board, aiop, chan);
+               tty_port_destroy(&info->port);
                kfree(info);
                return;
        }
@@ -2357,6 +2358,7 @@ static void rp_cleanup_module(void)
        for (i = 0; i < MAX_RP_PORTS; i++)
                if (rp_table[i]) {
                        tty_unregister_device(rocket_driver, i);
+                       tty_port_destroy(&rp_table[i]->port);
                        kfree(rp_table[i]);
                }