mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tty: serial: Remove the use of dev_err_probe()
@ 2025-08-19  9:24 Xichao Zhao
  2025-08-19  9:40 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Xichao Zhao @ 2025-08-19  9:24 UTC (permalink / raw)
  To: gregkh, jirislaby; +Cc: linux-kernel, linux-serial, Xichao Zhao

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");
+		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);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] tty: serial: Remove the use of dev_err_probe()
  2025-08-19  9:24 [PATCH] tty: serial: Remove the use of dev_err_probe() Xichao Zhao
@ 2025-08-19  9:40 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2025-08-19  9:40 UTC (permalink / raw)
  To: Xichao Zhao, gregkh; +Cc: linux-kernel, linux-serial

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-19  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-19  9:24 [PATCH] tty: serial: Remove the use of dev_err_probe() Xichao Zhao
2025-08-19  9:40 ` Jiri Slaby

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®