From patchwork Thu Aug 28 07:37:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 4795051 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E28BF9F375 for ; Thu, 28 Aug 2014 07:38:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 581F12016C for ; Thu, 28 Aug 2014 07:38:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B6332011D for ; Thu, 28 Aug 2014 07:38:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936016AbaH1Hhu (ORCPT ); Thu, 28 Aug 2014 03:37:50 -0400 Received: from mga01.intel.com ([192.55.52.88]:62775 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934221AbaH1Hht (ORCPT ); Thu, 28 Aug 2014 03:37:49 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 28 Aug 2014 00:37:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,416,1406617200"; d="scan'208";a="591004279" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.168]) by fmsmga002.fm.intel.com with ESMTP; 28 Aug 2014 00:37:47 -0700 Received: from andy by smile with local (Exim 4.84) (envelope-from ) id 1XMuHC-0001mB-Js; Thu, 28 Aug 2014 10:37:46 +0300 From: Andy Shevchenko To: Feng Tang , Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko , Subject: [PATCH] spi: dw-mid: check that DMA was inited before exit Date: Thu, 28 Aug 2014 10:37:40 +0300 Message-Id: <1409211460-6787-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: # v2.6.38+ --- drivers/spi/spi-dw-mid.c | 2 ++ 1 file changed, 2 insertions(+) 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); }