summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorSherry Sun <sherry.sun@nxp.com>2023-05-22 04:51:11 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-30 12:50:24 +0200
commit20ec397d694b05d3e7150e3ba15047c53e7e6b94 (patch)
tree5fcec3d6f7e998bffea209d029665260878001c2 /drivers/tty
parentserial: Switch i2c drivers back to use .probe() (diff)
downloadlinux-20ec397d694b05d3e7150e3ba15047c53e7e6b94.tar.xz
linux-20ec397d694b05d3e7150e3ba15047c53e7e6b94.zip
tty: serial: fsl_lpuart: Check the return value of dmaengine_tx_status
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> Link: https://lore.kernel.org/r/20230522025111.3747-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/fsl_lpuart.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 0e56fa64b4ce..0718c9f48d21 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);