diff options
| author | Mike Ajax <[email protected]> | 2026-04-23 22:00:53 -0700 |
|---|---|---|
| committer | Mike Ajax <[email protected]> | 2026-04-23 22:00:53 -0700 |
| commit | b5e63ca44c846813ece9ad9df684cae0d1d5b542 (patch) | |
| tree | 2378986f20c367e68bad4132c8361f0cc6501201 /src | |
| parent | 7b8871c942050717292a32b1e22bf87baed6c215 (diff) | |
typec/stm32: guard hard reset RX re-arm against uninitialized buffer
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/st/typec/typec_stm32.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/portable/st/typec/typec_stm32.c b/src/portable/st/typec/typec_stm32.c index fe9275245..d7e622925 100644 --- a/src/portable/st/typec/typec_stm32.c +++ b/src/portable/st/typec/typec_stm32.c @@ -342,8 +342,10 @@ void tcd_int_handler(uint8_t rhport) { // flag will remain set and re-enter the ISR immediately if (sr & UCPD_SR_RXHRSTDET) { TU_LOG3("Hard Reset received\r\n"); - dma_stop(rhport, true); - tcd_msg_receive(rhport, _rx_buf, _rx_buf_len); + if (_rx_buf != NULL && _rx_buf_len > 0) { + dma_stop(rhport, true); + tcd_msg_receive(rhport, _rx_buf, _rx_buf_len); + } UCPD1->ICR = UCPD_ICR_RXHRSTDETCF; } |
