]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
serial: txx9: add missing platform_driver_unregister() on error in serial_txx9_init
authorQinglang Miao <miaoqinglang@huawei.com>
Tue, 3 Nov 2020 08:49:42 +0000 (16:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2020 16:24:41 +0000 (17:24 +0100)
Add the missing platform_driver_unregister() before return
from serial_txx9_init in the error handling case when failed
to register serial_txx9_pci_driver with macro ENABLE_SERIAL_TXX9_PCI
defined.

Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20201103084942.109076-1-miaoqinglang@huawei.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_txx9.c

index b4d89e31730e3ab548303ef164f21ebbc30481b0..7a07e7272de1258d2bf48066ccd7d0e467a3244e 100644 (file)
@@ -1280,6 +1280,9 @@ static int __init serial_txx9_init(void)
 
 #ifdef ENABLE_SERIAL_TXX9_PCI
        ret = pci_register_driver(&serial_txx9_pci_driver);
+       if (ret) {
+               platform_driver_unregister(&serial_txx9_plat_driver);
+       }
 #endif
        if (ret == 0)
                goto out;