The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v1] tty: serial: ma35d1: Simplify with dev_err_probe()
@ 2024-08-29  8:53 Yu Jiaoliang
  2024-08-30  8:07 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Yu Jiaoliang @ 2024-08-29  8:53 UTC (permalink / raw)
  To: Jacky Huang, Shan-Chun Hung, Greg Kroah-Hartman, Jiri Slaby,
	linux-arm-kernel, linux-kernel, linux-serial
  Cc: opensource.kernel

Error handling in probe() can be a bit simpler with dev_err_probe().

Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
---
 drivers/tty/serial/ma35d1_serial.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c
index 3b4206e815fe..09d42a4054b3 100644
--- a/drivers/tty/serial/ma35d1_serial.c
+++ b/drivers/tty/serial/ma35d1_serial.c
@@ -692,10 +692,9 @@ static int ma35d1serial_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	ret = of_alias_get_id(pdev->dev.of_node, "serial");
-	if (ret < 0) {
-		dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret, "failed to get alias/pdev id\n");
+
 	up = &ma35d1serial_ports[ret];
 	up->port.line = ret;
 	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- 
2.34.1


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

* Re: [PATCH v1] tty: serial: ma35d1: Simplify with dev_err_probe()
  2024-08-29  8:53 [PATCH v1] tty: serial: ma35d1: Simplify with dev_err_probe() Yu Jiaoliang
@ 2024-08-30  8:07 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-30  8:07 UTC (permalink / raw)
  To: Yu Jiaoliang, Jacky Huang, Shan-Chun Hung, Greg Kroah-Hartman,
	Jiri Slaby, linux-arm-kernel, linux-kernel, linux-serial
  Cc: opensource.kernel

On 29/08/2024 10:53, Yu Jiaoliang wrote:
> Error handling in probe() can be a bit simpler with dev_err_probe().
> 
> Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
> ---
>  drivers/tty/serial/ma35d1_serial.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c
> index 3b4206e815fe..09d42a4054b3 100644
> --- a/drivers/tty/serial/ma35d1_serial.c
> +++ b/drivers/tty/serial/ma35d1_serial.c
> @@ -692,10 +692,9 @@ static int ma35d1serial_probe(struct platform_device *pdev)
>  		return -ENODEV;
>  
>  	ret = of_alias_get_id(pdev->dev.of_node, "serial");
> -	if (ret < 0) {
> -		dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", ret);
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(&pdev->dev, ret, "failed to get alias/pdev id\n");

This is kind of silly... You change part which cannot defer, but you
leave second dev_err() intact which actually would benefit from handling
defer and dev_err_probe().

You either do not understand the function at all or you split patches in
some artificial, fake way just to generate multiple patches.

That's pointless.

Best regards,
Krzysztof


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

end of thread, other threads:[~2024-08-30  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29  8:53 [PATCH v1] tty: serial: ma35d1: Simplify with dev_err_probe() Yu Jiaoliang
2024-08-30  8:07 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox