Skip to content

Commit c7da55e

Browse files
ydamigosnashif
authored andcommitted
spi_smartbond: check that DMA controllers were provided
Check that DMA controllers were provided in spi_smartbond_dma_deconfig() Signed-off-by: Ioannis Damigos <[email protected]>
1 parent 0a0bcca commit c7da55e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/spi/spi_smartbond.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -796,11 +796,13 @@ static void spi_smartbond_dma_deconfig(const struct device *dev)
796796
{
797797
const struct spi_smartbond_cfg *config = dev->config;
798798

799-
dma_stop(config->rx_dma_ctrl, config->rx_dma_chan);
800-
dma_stop(config->tx_dma_ctrl, config->tx_dma_chan);
799+
if (config->rx_dma_ctrl && config->tx_dma_ctrl) {
800+
dma_stop(config->rx_dma_ctrl, config->rx_dma_chan);
801+
dma_stop(config->tx_dma_ctrl, config->tx_dma_chan);
801802

802-
spi_smartbond_dma_rx_channel_release(dev);
803-
spi_smartbond_dma_tx_channel_release(dev);
803+
spi_smartbond_dma_rx_channel_release(dev);
804+
spi_smartbond_dma_tx_channel_release(dev);
805+
}
804806
}
805807
#endif
806808

0 commit comments

Comments
 (0)