mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/1] serial: 8250_bcm7271: Use dev_err_probe() instead of dev_err()
@ 2023-09-18 10:36 Andy Shevchenko
  2023-10-02 23:22 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2023-09-18 10:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: Al Cooper, Broadcom internal kernel review list, Jiri Slaby,
	Andy Shevchenko

Make the error messages format unified by switching to use
dev_err_probe() where it makes sense.

This also helps simplifing the code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: added missing assignment (Christophe)
 drivers/tty/serial/8250/8250_bcm7271.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c
index aa5aff046756..5c6c8929581a 100644
--- a/drivers/tty/serial/8250/8250_bcm7271.c
+++ b/drivers/tty/serial/8250/8250_bcm7271.c
@@ -984,10 +984,9 @@ static int brcmuart_probe(struct platform_device *pdev)
 	}
 
 	/* We should have just the uart base registers or all the registers */
-	if (x != 1 && x != REGS_MAX) {
-		dev_warn(dev, "%s registers not specified\n", reg_names[x]);
-		return -EINVAL;
-	}
+	if (x != 1 && x != REGS_MAX)
+		return dev_err_probe(dev, -EINVAL, "%s registers not specified\n",
+				     reg_names[x]);
 
 	/* if the DMA registers were specified, try to enable DMA */
 	if (x > REGS_DMA_RX) {
@@ -1034,8 +1033,7 @@ static int brcmuart_probe(struct platform_device *pdev)
 	}
 
 	if (clk_rate == 0) {
-		dev_err(dev, "clock-frequency or clk not defined\n");
-		ret = -EINVAL;
+		ret = dev_err_probe(dev, -EINVAL, "clock-frequency or clk not defined\n");
 		goto err_clk_disable;
 	}
 
@@ -1093,7 +1091,7 @@ static int brcmuart_probe(struct platform_device *pdev)
 
 	ret = serial8250_register_8250_port(&up);
 	if (ret < 0) {
-		dev_err(dev, "unable to register 8250 port\n");
+		dev_err_probe(dev, ret, "unable to register 8250 port\n");
 		goto err;
 	}
 	priv->line = ret;
@@ -1102,14 +1100,13 @@ static int brcmuart_probe(struct platform_device *pdev)
 	if (priv->dma_enabled) {
 		dma_irq = platform_get_irq_byname(pdev,  "dma");
 		if (dma_irq < 0) {
-			ret = dma_irq;
-			dev_err(dev, "no IRQ resource info\n");
+			ret = dev_err_probe(dev, dma_irq, "no IRQ resource info\n");
 			goto err1;
 		}
 		ret = devm_request_irq(dev, dma_irq, brcmuart_isr,
 				IRQF_SHARED, "uart DMA irq", &new_port->port);
 		if (ret) {
-			dev_err(dev, "unable to register IRQ handler\n");
+			dev_err_probe(dev, ret, "unable to register IRQ handler\n");
 			goto err1;
 		}
 	}
-- 
2.40.0.1.gaa8946217a0b


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

* Re: [PATCH v2 1/1] serial: 8250_bcm7271: Use dev_err_probe() instead of dev_err()
  2023-09-18 10:36 [PATCH v2 1/1] serial: 8250_bcm7271: Use dev_err_probe() instead of dev_err() Andy Shevchenko
@ 2023-10-02 23:22 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2023-10-02 23:22 UTC (permalink / raw)
  To: Andy Shevchenko, Greg Kroah-Hartman, linux-serial, linux-kernel
  Cc: Al Cooper, Broadcom internal kernel review list, Jiri Slaby

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

On 9/18/23 03:36, Andy Shevchenko wrote:
> Make the error messages format unified by switching to use
> dev_err_probe() where it makes sense.
> 
> This also helps simplifing the code.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

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

end of thread, other threads:[~2023-10-02 23:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18 10:36 [PATCH v2 1/1] serial: 8250_bcm7271: Use dev_err_probe() instead of dev_err() Andy Shevchenko
2023-10-02 23:22 ` Florian Fainelli

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®