From patchwork Fri Sep 12 12:11:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 4894291 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 119AA9F537 for ; Fri, 12 Sep 2014 12:09:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7B3E2026F for ; Fri, 12 Sep 2014 12:14:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD22C202E6 for ; Fri, 12 Sep 2014 12:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754321AbaILMOa (ORCPT ); Fri, 12 Sep 2014 08:14:30 -0400 Received: from mga02.intel.com ([134.134.136.20]:32609 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754060AbaILMOa (ORCPT ); Fri, 12 Sep 2014 08:14:30 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 12 Sep 2014 05:14:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,512,1406617200"; d="scan'208";a="601966650" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.168]) by orsmga002.jf.intel.com with ESMTP; 12 Sep 2014 05:14:10 -0700 Received: from andy by smile with local (Exim 4.84) (envelope-from ) id 1XSPhq-0004Mv-K2; Fri, 12 Sep 2014 15:12:02 +0300 From: Andy Shevchenko To: Feng Tang , Mark Brown , linux-spi@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 3/6] spi: dw-mid: check that DMA was inited before exit Date: Fri, 12 Sep 2014 15:11:58 +0300 Message-Id: <1410523921-16732-4-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1410523921-16732-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1410523921-16732-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-9.1 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 --- 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 6d207af..0d88e4a 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -89,6 +89,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); }