mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/4] serial: atmel: abort probe on atmel_serial_init_port failure
Date: Sat, 30 Oct 2021 19:54:45 +0200	[thread overview]
Message-ID: <20211030175446.2274194-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20211030175446.2274194-1-a.fatoum@pengutronix.de>

The port initialization fails if the memory region couldn't be requested
or if the clock couldn't be gotten. Both print an error message, so
users running into this would've noticed. Do the sane thing and abort
the probe in such error cases.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/serial/atmel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/atmel.c b/drivers/serial/atmel.c
index 8394273f9f42..612265692f64 100644
--- a/drivers/serial/atmel.c
+++ b/drivers/serial/atmel.c
@@ -427,6 +427,7 @@ static int atmel_serial_probe(struct device_d *dev)
 {
 	struct atmel_uart_port *uart;
 	struct console_device *cdev;
+	int ret;
 
 	uart = xzalloc(sizeof(struct atmel_uart_port));
 	cdev = &uart->uart;
@@ -438,7 +439,9 @@ static int atmel_serial_probe(struct device_d *dev)
 	cdev->set_mode = atmel_serial_set_mode;
 	cdev->linux_console_name = "ttyAT";
 
-	atmel_serial_init_port(cdev);
+	ret = atmel_serial_init_port(cdev);
+	if (ret)
+		return ret;
 
 	/* Enable UART */
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-10-30 17:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-30 17:54 [PATCH 1/4] misc: acpi-test: bump down debug message on remove Ahmad Fatoum
2021-10-30 17:54 ` [PATCH 2/4] usb: dwc3: remove unneeded EPROBE_DEFER check Ahmad Fatoum
2021-10-30 17:54 ` Ahmad Fatoum [this message]
2021-10-30 17:54 ` [PATCH 4/4] spi: zynq_qspi: don't check clk_get return value for NULLness Ahmad Fatoum
2021-11-01 10:28 ` [PATCH 1/4] misc: acpi-test: bump down debug message on remove Sascha Hauer

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=20211030175446.2274194-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --subject='Re: [PATCH 3/4] serial: atmel: abort probe on atmel_serial_init_port failure' \
    /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

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