Skip to contentSkip to conversation

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

PATCH New Andy Shevchenko 1 participant 1 message Aug 28, 2014 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 7063c0d942a1 (spi/dw_spi: add DMA support)
Cc <[email protected]> # v2.6.38+
---
 drivers/spi/spi-dw-mid.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/spi-dw-mid.c +2 -0
index ed521de..51fde71 100644
@@ -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);
 }
Signature · 6 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html