[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201031011857.137352-1-miaoqinglang@huawei.com>
Date: Sat, 31 Oct 2020 09:18:57 +0800
From: Qinglang Miao <miaoqinglang@...wei.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>
CC: <linux-serial@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Qinglang Miao" <miaoqinglang@...wei.com>
Subject: [PATCH] serial: txx9: add missing platform_driver_unregister() on error in serial_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.
Signed-off-by: Qinglang Miao <miaoqinglang@...wei.com>
---
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
Powered by blists - more mailing lists