All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: atmel: Check return code of dmaengine_submit()
@ 2021-11-15 14:30 ` Tudor Ambarus
  0 siblings, 0 replies; 10+ messages in thread
From: Tudor Ambarus @ 2021-11-15 14:30 UTC (permalink / raw)
  To: richard.genoud, gregkh, jirislaby
  Cc: nicolas.ferre, alexandre.belloni, ludovic.desroches,
	linux-serial, linux-arm-kernel, linux-kernel, Tudor Ambarus

dma_cookie_t < 0 indicates an error code, check for it.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/tty/serial/atmel_serial.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 2c99a47a2535..376f7a9c2868 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port)
 		desc->callback = atmel_complete_tx_dma;
 		desc->callback_param = atmel_port;
 		atmel_port->cookie_tx = dmaengine_submit(desc);
+		if (dma_submit_error(atmel_port->cookie_tx)) {
+			dev_err(port->dev, "dma_submit_error %d\n",
+				atmel_port->cookie_tx);
+			return;
+		}
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -1258,6 +1263,11 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
 	desc->callback_param = port;
 	atmel_port->desc_rx = desc;
 	atmel_port->cookie_rx = dmaengine_submit(desc);
+	if (dma_submit_error(atmel_port->cookie_rx)) {
+		dev_err(port->dev, "dma_submit_error %d\n",
+			atmel_port->cookie_rx);
+		goto chan_err;
+	}
 
 	return 0;
 
-- 
2.25.1


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

end of thread, other threads:[~2021-11-16 11:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 14:30 [PATCH] tty: serial: atmel: Check return code of dmaengine_submit() Tudor Ambarus
2021-11-15 14:30 ` Tudor Ambarus
2021-11-15 15:58 ` Greg KH
2021-11-15 15:58   ` Greg KH
2021-11-16  6:14   ` Tudor.Ambarus
2021-11-16  6:14     ` Tudor.Ambarus
2021-11-16  8:26     ` Greg KH
2021-11-16  8:26       ` Greg KH
2021-11-16 11:33       ` Tudor.Ambarus
2021-11-16 11:33         ` Tudor.Ambarus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.