From: Vignesh R <vigneshr@ti.com>
To: Nicholas Mc Guire <hofrat@osadl.org>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>,
Richard Weinberger <richard@nod.at>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Marek Vasut <marek.vasut@gmail.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 1/2] mtd: spi-nor: cadence-quadspi: fix timeout handling in wait_for_completion_timeout
Date: Sat, 21 Jul 2018 21:11:51 +0530 [thread overview]
Message-ID: <a0644f99-b997-2a94-01ac-dcc2656e984b@ti.com> (raw)
In-Reply-To: <1532182912-3674-1-git-send-email-hofrat@osadl.org>
Hi,
On 21-Jul-18 7:51 PM, Nicholas Mc Guire wrote:
> wait_for_completion_timeout returns unsigned long not int so a variable of
> proper type is introduced. Further the check for <= 0 is ambiguous and should
> be == 0 here.
>
Oops, my bad. Thanks for the fix! I see you have fixed similar bug in
cqspi_indirect_read_execute(). There is similar code in
cqspi_indirect_write_execute(). Could you fix that as well?
Regards
Vignesh
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> Fixes: ffa639e069fb ("mtd: spi-nor: cadence-quadspi: Add DMA support for direct mode reads")
> ---
>
> Patch found by experimental coccinelle API conformance checker
>> 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 | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index d7e10b3..79f6a54 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -953,6 +953,7 @@ static int cqspi_direct_read_execute(struct spi_nor *nor, u_char *buf,
> enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
> dma_addr_t dma_src = (dma_addr_t)cqspi->mmap_phys_base + from;
> int ret = 0;
> + unsigned long timeout;
> struct dma_async_tx_descriptor *tx;
> dma_cookie_t cookie;
> dma_addr_t dma_dst;
> @@ -988,9 +989,9 @@ static int cqspi_direct_read_execute(struct spi_nor *nor, u_char *buf,
> }
>
> dma_async_issue_pending(cqspi->rx_chan);
> - ret = wait_for_completion_timeout(&cqspi->rx_dma_complete,
> - msecs_to_jiffies(len));
> - if (ret <= 0) {
> + timeout = wait_for_completion_timeout(&cqspi->rx_dma_complete,
> + msecs_to_jiffies(len));
> + if (timeout == 0) {
> dmaengine_terminate_sync(cqspi->rx_chan);
> dev_err(nor->dev, "DMA wait_for_completion_timeout\n");
> ret = -ETIMEDOUT;
>
next prev parent reply other threads:[~2018-07-21 15:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-21 14:21 [PATCH 1/2] mtd: spi-nor: cadence-quadspi: fix timeout handling in wait_for_completion_timeout Nicholas Mc Guire
2018-07-21 14:21 ` [PATCH 2/2] mtd: spi-nor: cadence-quadspi: fix return type to fit wait_for_completion_timeout Nicholas Mc Guire
2018-07-21 15:41 ` Vignesh R [this message]
2018-07-21 15:52 ` [PATCH 1/2] mtd: spi-nor: cadence-quadspi: fix timeout handling in wait_for_completion_timeout Nicholas Mc Guire
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=a0644f99-b997-2a94-01ac-dcc2656e984b@ti.com \
--to=vigneshr@ti.com \
--cc=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=hofrat@osadl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox