From patchwork Thu Apr 23 19:13:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fionn Cleary X-Patchwork-Id: 6264721 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D585BBF4A6 for ; Thu, 23 Apr 2015 19:13:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 115752039E for ; Thu, 23 Apr 2015 19:13:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 290D320396 for ; Thu, 23 Apr 2015 19:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030420AbbDWTNv (ORCPT ); Thu, 23 Apr 2015 15:13:51 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:36353 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030434AbbDWTNu (ORCPT ); Thu, 23 Apr 2015 15:13:50 -0400 Received: by wizk4 with SMTP id k4so227759351wiz.1 for ; Thu, 23 Apr 2015 12:13:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:user-agent:date:message-id :mime-version:content-type; bh=FExZ1LSpRmH5kqqNTk3FMkPbzauqWbtY6JNKnNCoLfY=; b=Mdt0LYLdKClg4sI3srBqASnLIs2/0XPaM9ethBW6fDt5xwH8ogy493uyw0v1plU3JY PloQ4oKL/HiR6O/ussNBhBcSoQBkBr8mC0PMinu3VplMA2S6yYeC15gwZV8IoJmnI8ve Q+zjcQLIcmkmtYuEgPelYgogPtqTHbRrzskKn/X1vnq2i9QHl7Mc4lvfB4pxtFTdzkxz 1d1+LRID5DGnkb8faVHMYQzyIax+54Qu7nYKDculz7wSvw0CjxDf0E1qjX2M/gzfrkfE FiRQm0Hqf9Aeej2TM1vazaxJJSKa2fqkkrofl6eSr6DLUpVMQMIq1XuLw1dIV1Ncy0AM OLyw== X-Gm-Message-State: ALoCoQm+19mmvBFopj30d+nt5S7zLSzV6l74Aea1DFWiVhq5qK4FJPt4M3mHdeQ9LINfscmKplhi X-Received: by 10.180.101.2 with SMTP id fc2mr12838033wib.82.1429816429699; Thu, 23 Apr 2015 12:13:49 -0700 (PDT) Received: from localhost (178.115.133.134.wireless.dyn.drei.com. [178.115.133.134]) by mx.google.com with ESMTPSA id dj5sm13492461wjb.28.2015.04.23.12.13.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2015 12:13:48 -0700 (PDT) From: Fionn Cleary X-Google-Original-From: Fionn Cleary To: Mark Brown Cc: linux-spi@vger.kernel.org Subject: [PATCH] spi/omap2-mcpsi: Always call spi_finalize_current_message() User-Agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/24.4.2 (x86_64-unknown-linux-gnu) Date: Thu, 23 Apr 2015 21:13:40 +0200 Message-ID: <87h9s63bff.fsf@tcd.ie> MIME-Version: 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, T_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 The spi queue waits forever for spi_finalize_current_message() to be called, blocking the bus. Ensure that all error paths from omap2_mcspi_transfer_one_message() call spi_finalize_current_message(). Signed-off-by: Fionn Cleary --- drivers/spi/spi-omap2-mcspi.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 102cff5..f7b13e1 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1216,6 +1216,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, struct omap2_mcspi *mcspi; struct omap2_mcspi_dma *mcspi_dma; struct spi_transfer *t; + int status; spi = m->spi; mcspi = spi_master_get_devdata(master); @@ -1235,7 +1236,8 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, tx_buf ? "tx" : "", rx_buf ? "rx" : "", t->bits_per_word); - return -EINVAL; + status = -EINVAL; + goto out; } if (m->is_dma_mapped || len < DMA_MIN_BYTES) @@ -1247,7 +1249,8 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, if (dma_mapping_error(mcspi->dev, t->tx_dma)) { dev_dbg(mcspi->dev, "dma %cX %d bytes error\n", 'T', len); - return -EINVAL; + status = -EINVAL; + goto out; } } if (mcspi_dma->dma_rx && rx_buf != NULL) { @@ -1259,14 +1262,19 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, if (tx_buf != NULL) dma_unmap_single(mcspi->dev, t->tx_dma, len, DMA_TO_DEVICE); - return -EINVAL; + status = -EINVAL; + goto out; } } } omap2_mcspi_work(mcspi, m); + /* spi_finalize_current_message() changes the status inside the + * spi_message, save the status here. */ + status = m->status; +out: spi_finalize_current_message(master); - return 0; + return status; } static int omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)