[PATCH 3/4] serial: atmel: abort probe on atmel_serial_init_port failure

Ahmad Fatoum a.fatoum at pengutronix.de
Sat Oct 30 10:54:45 PDT 2021


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 at 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




More information about the barebox mailing list