diff mbox

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

Message ID 1409211460-6787-1-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit fb57862ead652454ceeb659617404c5f13bc34b5
Headers show

Commit Message

Andy Shevchenko Aug. 28, 2014, 7:37 a.m. UTC
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: 7063c0d942a1 (spi/dw_spi: add DMA support)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: <stable@vger.kernel.org> # v2.6.38+
---
 drivers/spi/spi-dw-mid.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index ed521de..51fde71 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -83,6 +83,8 @@  err_exit:
 
 static void mid_spi_dma_exit(struct dw_spi *dws)
 {
+	if (!dws->dma_inited)
+		return;
 	dma_release_channel(dws->txchan);
 	dma_release_channel(dws->rxchan);
 }