mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Xichao Zhao <zhao.xichao@vivo.com>, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: serial: Remove the use of dev_err_probe()
Date: Tue, 19 Aug 2025 11:40:54 +0200	[thread overview]
Message-ID: <764f68bc-ba87-4a7e-a150-49d7fdab2ed3@kernel.org> (raw)
In-Reply-To: <20250819092437.550759-1-zhao.xichao@vivo.com>

On 19. 08. 25, 11:24, Xichao Zhao wrote:
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'. Therefore,
> remove the useless call to dev_err_probe(), and just return the value instead.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>   drivers/tty/serial/max3100.c | 2 +-
>   drivers/tty/serial/max310x.c | 3 +--
>   2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
> index 67d80f8f801e..552b808a1bb2 100644
> --- a/drivers/tty/serial/max3100.c
> +++ b/drivers/tty/serial/max3100.c
> @@ -705,7 +705,7 @@ static int max3100_probe(struct spi_device *spi)
>   			break;
>   	if (i == MAX_MAX3100) {
>   		mutex_unlock(&max3100s_lock);
> -		return dev_err_probe(dev, -ENOMEM, "too many MAX3100 chips\n");

This one should be turned into ENOSPC instead.

> +		return -ENOMEM;
>   	}
>   
>   	max3100s[i] = kzalloc(sizeof(struct max3100_port), GFP_KERNEL);
> diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> index 541c790c0109..79bec9509154 100644
> --- a/drivers/tty/serial/max310x.c
> +++ b/drivers/tty/serial/max310x.c
> @@ -1269,8 +1269,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
>   	/* Alloc port structure */
>   	s = devm_kzalloc(dev, struct_size(s, p, devtype->nr), GFP_KERNEL);
>   	if (!s)
> -		return dev_err_probe(dev, -ENOMEM,
> -				     "Error allocating port structure\n");
> +		return -ENOMEM;
>   
>   	/* Always ask for fixed clock rate from a property. */
>   	device_property_read_u32(dev, "clock-frequency", &uartclk);


-- 
js
suse labs

      reply	other threads:[~2025-08-19  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19  9:24 Xichao Zhao
2025-08-19  9:40 ` Jiri Slaby [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=764f68bc-ba87-4a7e-a150-49d7fdab2ed3@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=zhao.xichao@vivo.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

all inboxes | Powered by JetHome®