diff mbox

[1/2,RESEND] mtd: fsmc_nand: fix handling of wait_for_completion_timeout return value

Message ID 1426247686-30980-1-git-send-email-hofrat@osadl.org
State Accepted
Commit 0bda3e194438dd6801b863e7a9c23ca80a7cff05
Headers show

Commit Message

Nicholas Mc Guire March 13, 2015, 11:54 a.m. UTC
wait_for_completion_timeout does not return negative values so
result handling here does not need to check for negative return.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Patch was compile tested with nhk8815_defconfig
(implies CONFIG_MTD_NAND_FSMC=y)

Patch is against 4.0-rc3 (localversion-next is -next-20150313

 drivers/mtd/nand/fsmc_nand.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Brian Norris May 7, 2015, 6:50 a.m. UTC | #1
On Fri, Mar 13, 2015 at 07:54:45AM -0400, Nicholas Mc Guire wrote:
> wait_for_completion_timeout does not return negative values so
> result handling here does not need to check for negative return.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> 
> Patch was compile tested with nhk8815_defconfig
> (implies CONFIG_MTD_NAND_FSMC=y)
> 
> Patch is against 4.0-rc3 (localversion-next is -next-20150313

Applied both to l2-mtd.git.
diff mbox

Patch

diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index edfaa21..7c0508f 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -604,11 +604,10 @@  static int dma_xfer(struct fsmc_nand_data *host, void *buffer, int len,
 	ret =
 	wait_for_completion_timeout(&host->dma_access_complete,
 				msecs_to_jiffies(3000));
-	if (ret <= 0) {
+	if (ret == 0) {
 		dmaengine_terminate_all(chan);
 		dev_err(host->dev, "wait_for_completion_timeout\n");
-		if (!ret)
-			ret = -ETIMEDOUT;
+		ret = -ETIMEDOUT;
 		goto unmap_dma;
 	}