diff options
author | Michael Walle <michael@walle.cc> | 2020-04-03 19:49:42 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-04-16 16:12:34 +0200 |
commit | 810bc0a5fafb8575b9406fcc8b0be77ff93a7be0 (patch) | |
tree | c9e604703b4f973dc039d6f7a282800d173375b3 /drivers/tty/serial/fsl_lpuart.c | |
parent | 5745fd0f950f1ac99c7c680245353a961da3ca14 (diff) | |
download | linux-stable-810bc0a5fafb8575b9406fcc8b0be77ff93a7be0.tar.gz linux-stable-810bc0a5fafb8575b9406fcc8b0be77ff93a7be0.tar.bz2 linux-stable-810bc0a5fafb8575b9406fcc8b0be77ff93a7be0.zip |
tty: serial: fsl_lpuart: make coverity happy
Coverity reports the following:
var_compare_op: Comparing chan to null implies that chan might be null.
1234 if (chan)
1235 dmaengine_terminate_all(chan);
1236
Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer chan.
1237 dma_unmap_sg(chan->device->dev, &sport->rx_sgl, 1, DMA_FROM_DEVICE);
Technically, this is correct. But lpuart_dma_rx_free() is guarded by
lpuart_dma_rx_use which is only true if there is a dma channel, see
lpuart_rx_dma_startup(). In any way, this looks bogus. So remove
the superfluous "if (chan)" check and make coverity happy.
Fixes: a092ab25fdaa ("tty: serial: fsl_lpuart: fix DMA mapping")
Signed-off-by: Michael Walle <michael@walle.cc>
Reported-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jiri Slaby <jslaby@suse.cz>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20200403174942.9594-1-michael@walle.cc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/fsl_lpuart.c')
-rw-r--r-- | drivers/tty/serial/fsl_lpuart.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 5d41075964f2..dba730d1801f 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1231,9 +1231,7 @@ static void lpuart_dma_rx_free(struct uart_port *port) struct lpuart_port, port); struct dma_chan *chan = sport->dma_rx_chan; - if (chan) - dmaengine_terminate_all(chan); - + dmaengine_terminate_all(chan); dma_unmap_sg(chan->device->dev, &sport->rx_sgl, 1, DMA_FROM_DEVICE); kfree(sport->rx_ring.buf); sport->rx_ring.tail = 0; |