public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: fsl_lpuart: Check the return value of dmaengine_tx_status
@ 2023-05-22  2:51 Sherry Sun
  2023-05-22 14:45 ` Shenwei Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Sherry Sun @ 2023-05-22  2:51 UTC (permalink / raw)
  To: gregkh, jirislaby, shenwei.wang, ilpo.jarvinen
  Cc: linux-serial, linux-kernel, linux-imx

Coverity reports the Unchecked return value (CHECKED_RETURN) warning:
Calling dmaengine_tx_status without checking return value.

So here add the return value check for dmaengine_tx_status() function to
make coverity happy.

Fixes: cf9aa72d2f91 ("tty: serial: fsl_lpuart: optimize the timer based EOP logic")
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
---
 drivers/tty/serial/fsl_lpuart.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 92a3bd0f4158..f2a47a8c5b85 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1286,13 +1286,19 @@ static void lpuart_dma_rx_complete(void *arg)
 static void lpuart_timer_func(struct timer_list *t)
 {
 	struct lpuart_port *sport = from_timer(sport, t, lpuart_timer);
+	enum dma_status dmastat;
 	struct dma_chan *chan = sport->dma_rx_chan;
 	struct circ_buf *ring = &sport->rx_ring;
 	struct dma_tx_state state;
 	unsigned long flags;
 	int count;
 
-	dmaengine_tx_status(chan, sport->dma_rx_cookie, &state);
+	dmastat = dmaengine_tx_status(chan, sport->dma_rx_cookie, &state);
+	if (dmastat == DMA_ERROR) {
+		dev_err(sport->port.dev, "Rx DMA transfer failed!\n");
+		return;
+	}
+
 	ring->head = sport->rx_sgl.length - state.residue;
 	count = CIRC_CNT(ring->head, ring->tail, sport->rx_sgl.length);
 
-- 
2.17.1


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

end of thread, other threads:[~2023-05-22 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-22  2:51 [PATCH] tty: serial: fsl_lpuart: Check the return value of dmaengine_tx_status Sherry Sun
2023-05-22 14:45 ` Shenwei Wang
2023-05-22 16:20   ` gregkh

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