summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/fsl_lpuart.c
diff options
context:
space:
mode:
authorShenwei Wang <shenwei.wang@nxp.com>2023-04-10 21:55:55 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 13:42:30 +0200
commitf73fd750552524b06b5d77ebfdd106ccc8fcac61 (patch)
tree3737eb93dffc0e1f1d471935d61cd6e583dde199 /drivers/tty/serial/fsl_lpuart.c
parentserial: fix TIOCSRS485 locking (diff)
downloadlinux-f73fd750552524b06b5d77ebfdd106ccc8fcac61.tar.xz
linux-f73fd750552524b06b5d77ebfdd106ccc8fcac61.zip
tty: serial: fsl_lpuart: adjust buffer length to the intended size
Based on the fls function definition provided below, we should not subtract 1 to obtain the correct buffer length: fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. Fixes: 5887ad43ee02 ("tty: serial: fsl_lpuart: Use cyclic DMA for Rx") Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com> Link: https://lore.kernel.org/r/20230410195555.1003900-1-shenwei.wang@nxp.com 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 074bfed57fc9..aef9be3e73c1 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1296,7 +1296,7 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport)
* 10ms at any baud rate.
*/
sport->rx_dma_rng_buf_len = (DMA_RX_TIMEOUT * baud / bits / 1000) * 2;
- sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1));
+ sport->rx_dma_rng_buf_len = (1 << fls(sport->rx_dma_rng_buf_len));
if (sport->rx_dma_rng_buf_len < 16)
sport->rx_dma_rng_buf_len = 16;