[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190531133733.16243-1-wangkefeng.wang@huawei.com>
Date: Fri, 31 May 2019 21:37:33 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Baruch Siach <baruch@...s.co.il>,
<linux-serial@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Hulk Robot <hulkci@...wei.com>
Subject: [PATCH] tty/serial: digicolor: Fix digicolor-usart already registered warning
When modprobe/rmmod/modprobe module, if platform_driver_register() fails,
the kernel complained,
proc_dir_entry 'driver/digicolor-usart' already registered
WARNING: CPU: 1 PID: 5636 at fs/proc/generic.c:360 proc_register+0x19d/0x270
Fix this by adding uart_unregister_driver() when platform_driver_register() fails.
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
---
drivers/tty/serial/digicolor-usart.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
index f460cca139e2..13ac36e2da4f 100644
--- a/drivers/tty/serial/digicolor-usart.c
+++ b/drivers/tty/serial/digicolor-usart.c
@@ -541,7 +541,11 @@ static int __init digicolor_uart_init(void)
if (ret)
return ret;
- return platform_driver_register(&digicolor_uart_platform);
+ ret = platform_driver_register(&digicolor_uart_platform);
+ if (ret)
+ uart_unregister_driver(&digicolor_uart);
+
+ return ret;
}
module_init(digicolor_uart_init);
--
2.20.1
Powered by blists - more mailing lists