Skip to content

Commit c37ffd3

Browse files
Martinhoff-makerfabiobaltieri
authored andcommitted
drivers: serial: silabs: Update ISR to check for DMA device presence
Since the symbol CONFIG_UART_ASYNC_API is shared between EUSART and USART drivers, it creates a scenario where EUSART can have CONFIG_UART_SILABS_USART_ASYNC=y but with no DMA device declared for it in the DTS (because we only want async API for the USART driver). We handled this case by disabling async transfer when the DMA device is null, but when we activate CONFIG_PM, we have a hard fault due to null pointer dereference in the ISR. This bug was only discovered today when trying to enable CONFIG_PM over the uart_async_api test, which led to a hard fault in the ISR. This occurs because we only enable interrupts when the PM is enabled in the "poll_out" function to put the PM lock back. Signed-off-by: Martin Hoff <[email protected]>
1 parent ccfe646 commit c37ffd3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

drivers/serial/uart_silabs_eusart.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,9 @@ static void eusart_isr(const struct device *dev)
778778
}
779779
#endif
780780
#ifdef CONFIG_UART_SILABS_EUSART_ASYNC
781-
781+
if (!data->dma_tx.dma_dev) {
782+
return;
783+
}
782784
if (flags & EUSART_IF_RXTO) {
783785
if (data->dma_rx.timeout == 0) {
784786
eusart_dma_rx_flush(data);

drivers/serial/uart_silabs_usart.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,9 @@ static void uart_silabs_isr(const struct device *dev)
765765
}
766766
#endif
767767
#ifdef CONFIG_UART_SILABS_USART_ASYNC
768+
if (!data->dma_tx.dma_dev) {
769+
return;
770+
}
768771
if (flags & USART_IF_TCMP1) {
769772

770773
data->dma_rx.timeout_cnt++;

0 commit comments

Comments
 (0)