public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Zheng Bin <zhengbin13@huawei.com>,
	gregkh@linuxfoundation.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: gaochao49@huawei.com
Subject: Re: [PATCH -next] tty: serial: max3100: Add missing uart_unregister_driver in max3100_probe
Date: Wed, 11 May 2022 11:38:24 +0200	[thread overview]
Message-ID: <cc73ed8b-b51f-59bc-ef4b-5f7e4ab26828@kernel.org> (raw)
In-Reply-To: <20220511071523.3128725-1-zhengbin13@huawei.com>

On 11. 05. 22, 9:15, Zheng Bin wrote:
> max3100_probe misses a call uart_unregister_driver in error path,
> this patch fixes that.

I believe, that's intentional. Cf. uart_driver_registered.

> Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
> ---
>   drivers/tty/serial/max3100.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
> index 0b5f21fbb53d..6d34ca2a3f7b 100644
> --- a/drivers/tty/serial/max3100.c
> +++ b/drivers/tty/serial/max3100.c
> @@ -752,6 +752,7 @@ static int max3100_probe(struct spi_device *spi)
>   		if (!max3100s[i])
>   			break;
>   	if (i == MAX_MAX3100) {
> +		uart_unregister_driver(&max3100_uart_driver);
>   		dev_warn(&spi->dev, "too many MAX3100 chips\n");
>   		mutex_unlock(&max3100s_lock);
>   		return -ENOMEM;
> @@ -759,6 +760,7 @@ static int max3100_probe(struct spi_device *spi)
> 
>   	max3100s[i] = kzalloc(sizeof(struct max3100_port), GFP_KERNEL);
>   	if (!max3100s[i]) {
> +		uart_unregister_driver(&max3100_uart_driver);
>   		dev_warn(&spi->dev,
>   			 "kmalloc for max3100 structure %d failed!\n", i);
>   		mutex_unlock(&max3100s_lock);
> --
> 2.31.1
> 


-- 
js
suse labs

  reply	other threads:[~2022-05-11  9:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11  7:15 [PATCH -next] tty: serial: max3100: Add missing uart_unregister_driver in max3100_probe Zheng Bin
2022-05-11  9:38 ` Jiri Slaby [this message]
2022-05-17 10:17 ` Greg KH

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=cc73ed8b-b51f-59bc-ef4b-5f7e4ab26828@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=gaochao49@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=zhengbin13@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