Skip to content

Commit 30fc515

Browse files
committed
stm32/spi: Deinit SPI DMA handles in spi_deinit.
1 parent 4dfc5e8 commit 30fc515

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ports/stm32/spi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,12 @@ int spi_init(const spi_t *self, bool enable_nss_pin) {
510510
}
511511

512512
void spi_deinit(const spi_t *spi_obj) {
513+
if (spi_obj->rx_dma_descr != NULL) {
514+
dma_deinit(spi_obj->rx_dma_descr);
515+
}
516+
if (spi_obj->tx_dma_descr != NULL) {
517+
dma_deinit(spi_obj->tx_dma_descr);
518+
}
513519
SPI_HandleTypeDef *spi = spi_obj->spi;
514520
HAL_SPI_DeInit(spi);
515521
if (0) {

0 commit comments

Comments
 (0)