[PATCH] serial: txx9: add missing platform_driver_unregister() on error in serial_txx9_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Qinglang Miao <miaoqinglang@xxxxxxxxxx>
---
 drivers/tty/serial/serial_txx9.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index b4d89e317..3d883cd55 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -1280,10 +1280,13 @@ static int __init serial_txx9_init(void)
 
 #ifdef ENABLE_SERIAL_TXX9_PCI
 	ret = pci_register_driver(&serial_txx9_pci_driver);
+	if (ret)
+		goto unreg_platform_drv;
 #endif
-	if (ret == 0)
-		goto out;
+	return 0;
 
+ unreg_platform_drv:
+	platform_driver_unregister(&serial_txx9_plat_driver);
  del_dev:
 	platform_device_del(serial_txx9_plat_devs);
  put_dev:
-- 
2.23.0




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux