* [PATCH] tty/serial: digicolor: Fix digicolor-usart already registered warning
@ 2019-05-31 13:37 Kefeng Wang
2019-06-01 20:21 ` Baruch Siach
0 siblings, 1 reply; 2+ messages in thread
From: Kefeng Wang @ 2019-05-31 13:37 UTC (permalink / raw)
To: Greg Kroah-Hartman, Baruch Siach, linux-serial
Cc: linux-kernel, Kefeng Wang, Hulk Robot
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tty/serial: digicolor: Fix digicolor-usart already registered warning
2019-05-31 13:37 [PATCH] tty/serial: digicolor: Fix digicolor-usart already registered warning Kefeng Wang
@ 2019-06-01 20:21 ` Baruch Siach
0 siblings, 0 replies; 2+ messages in thread
From: Baruch Siach @ 2019-06-01 20:21 UTC (permalink / raw)
To: Kefeng Wang; +Cc: Greg Kroah-Hartman, linux-serial, linux-kernel, Hulk Robot
Hi Kefeng,
On Fri, May 31 2019, Kefeng Wang wrote:
> 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>
Thanks,
baruch
> ---
> 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);
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-01 20:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-31 13:37 [PATCH] tty/serial: digicolor: Fix digicolor-usart already registered warning Kefeng Wang
2019-06-01 20:21 ` Baruch Siach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).