[PATCH 10/20] serial: atmel: Check result of clk_get()

Andrey Smirnov andrew.smirnov at gmail.com
Wed Mar 8 14:08:59 PST 2017


Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 drivers/serial/atmel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/serial/atmel.c b/drivers/serial/atmel.c
index 4e4624e..ab94fd2 100644
--- a/drivers/serial/atmel.c
+++ b/drivers/serial/atmel.c
@@ -403,6 +403,11 @@ static int atmel_serial_init_port(struct console_device *cdev)
 		return -ENOENT;
 
 	uart->clk = clk_get(dev, "usart");
+	if (IS_ERR(uart->clk)) {
+		dev_err(dev, "Failed to get 'usart' clock\n");
+		return PTR_ERR(uart->clk);
+	}
+
 	clk_enable(uart->clk);
 	uart->uartclk = clk_get_rate(uart->clk);
 
-- 
2.9.3




More information about the barebox mailing list