From patchwork Wed Apr 22 13:39:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fionn Cleary X-Patchwork-Id: 6256261 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 3EF81BF4A6 for ; Wed, 22 Apr 2015 13:40:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8EADD202F2 for ; Wed, 22 Apr 2015 13:40:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4859E20219 for ; Wed, 22 Apr 2015 13:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756129AbbDVNkG (ORCPT ); Wed, 22 Apr 2015 09:40:06 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:38890 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756033AbbDVNkF (ORCPT ); Wed, 22 Apr 2015 09:40:05 -0400 Received: by wiun10 with SMTP id n10so57705709wiu.1 for ; Wed, 22 Apr 2015 06:40:04 -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=DXeSfiD2ep1en7CC3irA4Ve7Ba9x2k66go83lmJJmds=; b=JvSldoBpRs9y6kOP10C3wEmWL7PW3Agx5LJHwGz9jcuRgl6QlEWO1xzbMq3AYtSJuL hKkvMukFCuclbeBrKk09Z90KpXYepIC3IbYE9DNECGla7PU7AvmOGt42ErNWFo8zbVna /Tgju9y8c+HEqdD4AsbfBusl47ykh7rj1gkCqpLFShdlCzIr/bGZUOrY4p0bxfYSdu3M ZpfU8nhnahQDzfTJJUSikL7yQA085C2bN0DKKk6KDDSaSufU1zLvRbLAd73Fa23mV7/5 1vOTqvTBAeNSvB0Y5HwZQ9fQzSP3bO9WiGWMwbg8To+5kcqwv5//dheCFBDNpdCU/hdV Zwmw== X-Gm-Message-State: ALoCoQl4LB+OThHr/bv7KAWwKc4OyNy27xl67BUF7ppBA1GDY2zpNi3y907pg5oS9q+Y4EJo5x6k X-Received: by 10.180.211.2 with SMTP id my2mr5912813wic.78.1429710004253; Wed, 22 Apr 2015 06:40:04 -0700 (PDT) Received: from localhost (vpn.streamunlimited.com. [91.114.0.140]) by mx.google.com with ESMTPSA id ei4sm7823072wib.22.2015.04.22.06.40.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2015 06:40:03 -0700 (PDT) From: Fionn Cleary To: broonie@sirena.org.uk 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: Wed, 22 Apr 2015 15:39:56 +0200 Message-ID: <87vbgo2ser.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, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham 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 Hi, While testing the omap2-mcspi driver I discovered that triggering the error conditions in omap2_mcspi_transfer_one_message() will result in the queue for the bus locking up while waiting for spi_finalize_current_message(). This patch ensure that spi_finalize_current_message() is always called for all error conditions in omap2_mcspi_transfer_one_message(). Regards, Fionn From 2ec7ba94e9045a78de14192690134fc3d53c38f0 Mon Sep 17 00:00:00 2001 From: Fionn Cleary Date: Wed, 22 Apr 2015 13:40:53 +0200 Subject: [PATCH] spi/omap2-mcpsi: Always call spi_finalize_current_message() 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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 3bc3cba..4acce76 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1234,7 +1234,8 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, tx_buf ? "tx" : "", rx_buf ? "rx" : "", t->bits_per_word); - return -EINVAL; + m->status = -EINVAL; + goto out; } if (m->is_dma_mapped || len < DMA_MIN_BYTES) @@ -1246,7 +1247,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; + m->status = -EINVAL; + goto out; } } if (mcspi_dma->dma_rx && rx_buf != NULL) { @@ -1258,14 +1260,16 @@ 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; + m->status = -EINVAL; + goto out; } } } omap2_mcspi_work(mcspi, m); +out: spi_finalize_current_message(master); - return 0; + return m->status; } static int omap2_mcspi_master_setup(struct omap2_mcspi *mcspi) -- 1.9.1