]> Git Repo - linux.git/commitdiff
serial: stm32: correct loop for dma error handling
authorValentin Caron <[email protected]>
Tue, 4 Jan 2022 18:24:45 +0000 (19:24 +0100)
committerGreg Kroah-Hartman <[email protected]>
Thu, 6 Jan 2022 14:58:46 +0000 (15:58 +0100)
In this error handling, "transmit_chars_dma" function will call
"transmit_chars_pio" once per characters. But "transmit_chars_pio" will
continue to send characters while xmit buffer is not empty.

Remove this useless loop, one call is sufficient.

Signed-off-by: Valentin Caron <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/tty/serial/stm32-usart.c

index 788e002688f23d59b0e66f3998d7f795ebcaa3dc..1f89ab0e49ac4d61e8c5bc7486c0d2c05bf9bbc3 100644 (file)
@@ -477,7 +477,7 @@ static void stm32_usart_transmit_chars_dma(struct uart_port *port)
        const struct stm32_usart_offsets *ofs = &stm32port->info->ofs;
        struct circ_buf *xmit = &port->state->xmit;
        struct dma_async_tx_descriptor *desc = NULL;
-       unsigned int count, i;
+       unsigned int count;
 
        if (stm32_usart_tx_dma_started(stm32port)) {
                if (!stm32_usart_tx_dma_enabled(stm32port))
@@ -542,8 +542,7 @@ static void stm32_usart_transmit_chars_dma(struct uart_port *port)
        return;
 
 fallback_err:
-       for (i = count; i > 0; i--)
-               stm32_usart_transmit_chars_pio(port);
+       stm32_usart_transmit_chars_pio(port);
 }
 
 static void stm32_usart_transmit_chars(struct uart_port *port)
This page took 0.06458 seconds and 4 git commands to generate.