mtd: nand: sunxi: Fix the non-polling case in sunxi_nfc_wait_events()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Feb 12 18:59:05 PST 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=19649e2c16fbc94b664f7074ec4fa9f15292fdce
Commit:     19649e2c16fbc94b664f7074ec4fa9f15292fdce
Parent:     656441478ed55d960df5f3ccdf5a0f8c61dfd0b3
Author:     Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Fri Jan 6 10:42:05 2017 +0100
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Mon Feb 6 09:35:14 2017 +0100

    mtd: nand: sunxi: Fix the non-polling case in sunxi_nfc_wait_events()
    
    wait_for_completion_timeout() returns 0 if a timeout occurred, 1
    otherwise. Fix the sunxi_nfc_wait_events() accordingly.
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/nand/sunxi_nand.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index e40482a..ba78e13 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -321,6 +321,10 @@ static int sunxi_nfc_wait_events(struct sunxi_nfc *nfc, u32 events,
 
 		ret = wait_for_completion_timeout(&nfc->complete,
 						msecs_to_jiffies(timeout_ms));
+		if (!ret)
+			ret = -ETIMEDOUT;
+		else
+			ret = 0;
 
 		writel(0, nfc->regs + NFC_REG_INT);
 	} else {



More information about the linux-mtd-cvs mailing list