[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1470230426-26153-1-git-send-email-fabien.lahoudere@collabora.co.uk>
Date: Wed, 3 Aug 2016 15:20:25 +0200
From: Fabien Lahoudere <fabien.lahoudere@...labora.co.uk>
To: unlisted-recipients:; (no To-header on input)
Cc: Hannu Koivisto <hannu.koivisto@...cit.fi>,
Martyn Welch <martyn.welch@...labora.co.uk>,
Fabien Lahoudere <fabien.lahoudere@...labora.co.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
linux-serial@...r.kernel.org (open list:SERIAL DRIVERS),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 1/1] serial/imx: fail startup if DMA initialization fails
From: Hannu Koivisto <hannu.koivisto@...cit.fi>
[Ported to newer kernel and added description by Martyn Welch
<martyn.welch@...labora.co.uk>]
Configuration of DMA operation on an imx UART can fail, though the return
value is never checked and this goes unnoticed. Add error checking and fail
if this operation doesn't succeed.
Signed-off-by: Martyn Welch <martyn.welch@...labora.co.uk>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@...labora.co.uk>
---
drivers/tty/serial/imx.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 08ccfe1..c190986 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1255,8 +1255,14 @@ static int imx_startup(struct uart_port *port)
/* Can we enable the DMA support? */
if (is_imx6q_uart(sport) && !uart_console(port) &&
- !sport->dma_is_inited)
- imx_uart_dma_init(sport);
+ !sport->dma_is_inited) {
+ retval = imx_uart_dma_init(sport);
+ if (retval) {
+ clk_disable_unprepare(sport->clk_per);
+ clk_disable_unprepare(sport->clk_ipg);
+ return retval;
+ }
+ }
spin_lock_irqsave(&sport->port.lock, flags);
/* Reset fifo's and state machines */
--
2.7.4
Powered by blists - more mailing lists