summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorKefeng Wang <wangkefeng.wang@huawei.com>2019-05-31 21:37:33 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-31 07:24:37 +0200
commitf0728a6e34ee4dbb846945824d582ad258eca99a (patch)
tree4802a2f460b0f5a3412a19ca85098c3b04570c93 /drivers/tty/serial
parent5b885e012f60cea6e78e0d812eb5ea2e19539351 (diff)
downloadlinux-stable-f0728a6e34ee4dbb846945824d582ad258eca99a.tar.gz
linux-stable-f0728a6e34ee4dbb846945824d582ad258eca99a.tar.bz2
linux-stable-f0728a6e34ee4dbb846945824d582ad258eca99a.zip
tty/serial: digicolor: Fix digicolor-usart already registered warning
[ Upstream commit c7ad9ba0611c53cfe194223db02e3bca015f0674 ] 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@huawei.com> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Acked-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/digicolor-usart.c6
1 files changed, 5 insertions, 1 deletions
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);