Linux-SPI Archive on lore.kernel.org
 help / color / Atom feed
From: Daisuke Yamane <yamane07ynct@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Daisuke Yamane <yamane07ynct@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] spi: a3700: fix hang caused by a3700_spi_transfer_one_fifo()
Date: Tue, 30 Jun 2020 02:44:21 +0900
Message-ID: <20200629174421.25784-1-yamane07ynct@gmail.com> (raw)

transfer_one() must call spi_finalize_current_transfer() before
returning to inform current transfer has finished. Otherwise spi driver
doesn't issue next transfer, and hang.
However a3700_spi_transfer_one_fifo() doesn't call it if waiting for
"wfifo empty" or "xfer ready" has timed out.
Thus, this patch corrects error handling of them.

Signed-off-by: Daisuke Yamane <yamane07ynct@gmail.com>
---
 drivers/spi/spi-armada-3700.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c
index fcde419e480c..1eb2c64386c3 100644
--- a/drivers/spi/spi-armada-3700.c
+++ b/drivers/spi/spi-armada-3700.c
@@ -698,13 +698,15 @@ static int a3700_spi_transfer_one_fifo(struct spi_master *master,
 			if (!a3700_spi_transfer_wait(spi,
 						     A3700_SPI_WFIFO_EMPTY)) {
 				dev_err(&spi->dev, "wait wfifo empty timed out\n");
-				return -ETIMEDOUT;
+				ret = -ETIMEDOUT;
+				goto error;
 			}
 		}
 
 		if (!a3700_spi_transfer_wait(spi, A3700_SPI_XFER_RDY)) {
 			dev_err(&spi->dev, "wait xfer ready timed out\n");
-			return -ETIMEDOUT;
+			ret = -ETIMEDOUT;
+			goto error;
 		}
 
 		val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG);
-- 
2.17.1


             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 17:44 Daisuke Yamane [this message]
2020-06-30 11:11 ` Mark Brown
2020-07-01 13:18   ` Daisuke Yamane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200629174421.25784-1-yamane07ynct@gmail.com \
    --to=yamane07ynct@gmail.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-SPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-spi/0 linux-spi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-spi linux-spi/ https://lore.kernel.org/linux-spi \
		linux-spi@vger.kernel.org
	public-inbox-index linux-spi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-spi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git