tty: serial: fsl_lpuart: use the sg count from dma_map_sg
authorPeng Fan <peng.fan@nxp.com>
Tue, 5 Nov 2019 05:51:10 +0000 (05:51 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:42:21 +0000 (08:42 +0100)
commit6b64c361baa7bd59c8bf2d1dfafb77c551463fb9
tree4ee6afee022307d7017e1f09e99c43ceae551e36
parent5f43cf50ef5917742e3cdee9c396691e990c068b
tty: serial: fsl_lpuart: use the sg count from dma_map_sg

commit 487ee861de176090b055eba5b252b56a3b9973d6 upstream.

The dmaengine_prep_slave_sg needs to use sg count returned
by dma_map_sg, not use sport->dma_tx_nents, because the return
value of dma_map_sg is not always same with "nents".

When enabling iommu for lpuart + edma, iommu framework may concatenate
two sgs into one.

Fixes: 6250cc30c4c4e ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx")
Cc: <stable@vger.kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1572932977-17866-1-git-send-email-peng.fan@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c