diff options
author | Qinglang Miao <miaoqinglang@huawei.com> | 2020-11-03 16:49:42 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-11-10 12:36:00 +0100 |
commit | 288609c2bae2b08a21d1c794053c7e761620a946 (patch) | |
tree | 1c8319b824e007199d683a0f4467c5725c554391 | |
parent | 18f5757d7fd3ae455c2fcfd60efd5242ea9836f6 (diff) | |
download | linux-stable-288609c2bae2b08a21d1c794053c7e761620a946.tar.gz linux-stable-288609c2bae2b08a21d1c794053c7e761620a946.tar.bz2 linux-stable-288609c2bae2b08a21d1c794053c7e761620a946.zip |
serial: txx9: add missing platform_driver_unregister() on error in serial_txx9_init
commit 0c5fc92622ed5531ff324b20f014e9e3092f0187 upstream.
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>
-rw-r--r-- | drivers/tty/serial/serial_txx9.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index 1b4008d022bf..2f7ef64536a0 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -1284,6 +1284,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; |