All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Zheng Bin <zhengbin13@huawei.com>
Cc: jirislaby@kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, gaochao49@huawei.com
Subject: Re: [PATCH -next] tty: serial: max3100: Add missing uart_unregister_driver in max3100_probe
Date: Tue, 17 May 2022 12:17:19 +0200	[thread overview]
Message-ID: <YoN2L5B6PE5pJU7c@kroah.com> (raw)
In-Reply-To: <20220511071523.3128725-1-zhengbin13@huawei.com>

On Wed, May 11, 2022 at 03:15:23PM +0800, Zheng Bin wrote:
> max3100_probe misses a call uart_unregister_driver in error path,
> this patch fixes that.
> 
> 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);

As Jiri said, this change would break the existing devices that are
registered with this driver.

How did you test this change?  What tool found this?  How was it
verified?

thanks,

greg k-h

      parent reply	other threads:[~2022-05-17 10:19 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
2022-05-17 10:17 ` Greg KH [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=YoN2L5B6PE5pJU7c@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=gaochao49@huawei.com \
    --cc=jirislaby@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.