linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH] tty/serial: digicolor: Fix digicolor-usart already registered warning
Date: Sat, 01 Jun 2019 23:21:28 +0300	[thread overview]
Message-ID: <8736ktoy47.fsf@tarshish> (raw)
In-Reply-To: <20190531133733.16243-1-wangkefeng.wang@huawei.com>

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 -

      reply	other threads:[~2019-06-01 20:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736ktoy47.fsf@tarshish \
    --to=baruch@tkos.co.il \
    --cc=gregkh@linuxfoundation.org \
    --cc=hulkci@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).