Skip to content

Commit

Permalink
serial: txx9: add missing platform_driver_unregister() on error in se…
Browse files Browse the repository at this point in the history
…rial_txx9_init

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: ab4382d ("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>
  • Loading branch information
Qinglang Miao authored and Greg Kroah-Hartman committed Nov 6, 2020
1 parent 427627a commit 0c5fc92
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/tty/serial/serial_txx9.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0c5fc92

Please sign in to comment.