s32k3xx:Serial Do not wait on TXDMA semaphore

If using flow control with a high CTS the thread may be
    blocked forever on the second transmit attempt due to waiting
    on the txdma semaphore.  The calling thread can then never
    make progress and release any resources it has taken, thus
    may cause a deadlock in other parts of the system.

    The implementation differs in behavior from interrupt-driven
    TX. It should not implicitly wait on a taken semaphore but
    return immediately and let the upper layers decide on what to
    do next.
This commit is contained in:
David Sidrane 2023-11-10 01:34:05 -08:00 committed by Xiang Xiao
parent 54b4cd3bf3
commit 8362e3147e
1 changed files with 5 additions and 2 deletions

View File

@ -3969,9 +3969,12 @@ static void s32k3xx_dma_txavailable(struct uart_dev_s *dev)
/* Only send when the DMA is idle */ /* Only send when the DMA is idle */
nxsem_wait(&priv->txdmasem); int rv = nxsem_trywait(&priv->txdmasem);
uart_xmitchars_dma(dev); if (rv == OK)
{
uart_xmitchars_dma(dev);
}
} }
#endif #endif