Commit fb57862e authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown

spi: dw-mid: check that DMA was inited before exit

If the driver was compiled with DMA support, but DMA channels weren't acquired
by some reason, mid_spi_dma_exit() will crash the kernel.

Fixes: 7063c0d9 (spi/dw_spi: add DMA support)
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 05ed2aee
...@@ -89,6 +89,8 @@ static int mid_spi_dma_init(struct dw_spi *dws) ...@@ -89,6 +89,8 @@ static int mid_spi_dma_init(struct dw_spi *dws)
static void mid_spi_dma_exit(struct dw_spi *dws) static void mid_spi_dma_exit(struct dw_spi *dws)
{ {
if (!dws->dma_inited)
return;
dma_release_channel(dws->txchan); dma_release_channel(dws->txchan);
dma_release_channel(dws->rxchan); dma_release_channel(dws->rxchan);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment