All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: cadence-quadspi: make return type fit wait_for_completion_timeout
@ 2018-07-21 16:08 Nicholas Mc Guire
  2018-07-24 20:46 ` Boris Brezillon
  0 siblings, 1 reply; 6+ messages in thread
From: Nicholas Mc Guire @ 2018-07-21 16:08 UTC (permalink / raw)
  To: Graham Moore
  Cc: Vignesh R, Marek Vasut, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger, linux-mtd, linux-kernel,
	Nicholas Mc Guire

wait_for_completion_timeout returns an unsigned long not int. declare a
suitably type timeout and fix up assignment and check.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reported-by: Vignesh R <vigneshr@ti.com>
Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
---

Given that CQSPI_TIMEOUT_MS is < INT_MAX the type conversion is actually safe
here but it is cleaner to use proper types.

Patch was compile tested with: socfpga_defconfig (implies
CONFIG_SPI_CADENCE_QUADSPI=y)

Patch is against 4.18-rc5 (localversion-next is next-20180720)

 drivers/mtd/spi-nor/cadence-quadspi.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index d7e10b3..ce5f840 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -622,6 +622,7 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor, loff_t to_addr,
 	unsigned int remaining = n_tx;
 	unsigned int write_bytes;
 	int ret;
+	unsigned long timeout;
 
 	writel(to_addr, reg_base + CQSPI_REG_INDIRECTWRSTARTADDR);
 	writel(remaining, reg_base + CQSPI_REG_INDIRECTWRBYTES);
@@ -649,10 +650,10 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor, loff_t to_addr,
 		iowrite32_rep(cqspi->ahb_base, txbuf,
 			      DIV_ROUND_UP(write_bytes, 4));
 
-		ret = wait_for_completion_timeout(&cqspi->transfer_complete,
-						  msecs_to_jiffies
-						  (CQSPI_TIMEOUT_MS));
-		if (!ret) {
+		timeout = wait_for_completion_timeout(&cqspi->transfer_complete,
+						      msecs_to_jiffies
+						      (CQSPI_TIMEOUT_MS));
+		if (!timeout) {
 			dev_err(nor->dev, "Indirect write timeout\n");
 			ret = -ETIMEDOUT;
 			goto failwr;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-27  7:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-21 16:08 [PATCH] mtd: spi-nor: cadence-quadspi: make return type fit wait_for_completion_timeout Nicholas Mc Guire
2018-07-24 20:46 ` Boris Brezillon
2018-07-25  6:31   ` Nicholas Mc Guire
2018-07-26 20:09     ` Boris Brezillon
2018-07-27  5:21       ` Nicholas Mc Guire
2018-07-27  7:47         ` Boris Brezillon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.