spi_smartbond: check that DMA controllers were provided
Check that DMA controllers were provided in
spi_smartbond_dma_deconfig()
Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
diff --git a/drivers/spi/spi_smartbond.c b/drivers/spi/spi_smartbond.c
index 2bae051..bac4741 100644
--- a/drivers/spi/spi_smartbond.c
+++ b/drivers/spi/spi_smartbond.c
@@ -796,11 +796,13 @@
{
const struct spi_smartbond_cfg *config = dev->config;
- dma_stop(config->rx_dma_ctrl, config->rx_dma_chan);
- dma_stop(config->tx_dma_ctrl, config->tx_dma_chan);
+ if (config->rx_dma_ctrl && config->tx_dma_ctrl) {
+ dma_stop(config->rx_dma_ctrl, config->rx_dma_chan);
+ dma_stop(config->tx_dma_ctrl, config->tx_dma_chan);
- spi_smartbond_dma_rx_channel_release(dev);
- spi_smartbond_dma_tx_channel_release(dev);
+ spi_smartbond_dma_rx_channel_release(dev);
+ spi_smartbond_dma_tx_channel_release(dev);
+ }
}
#endif