From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: [PATCH] spi_dw_midpci: fix oops during modprobe -r Date: Thu, 23 Aug 2012 14:25:11 +0300 Message-ID: <1345721111-20133-1-git-send-email-andriy.shevchenko@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Andy Shevchenko To: Grant Likely , spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org In case there were no DMA channel requested the modprobe -r spi_dw_midpci is going to crash. This patch fixes an issue. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-dw-mid.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index b9f0192..4fac682 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -89,8 +89,10 @@ err_exit: static void mid_spi_dma_exit(struct dw_spi *dws) { - dma_release_channel(dws->txchan); - dma_release_channel(dws->rxchan); + if (dws->dma_inited) { + dma_release_channel(dws->txchan); + dma_release_channel(dws->rxchan); + } } /* -- 1.7.10.4 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/