blob: 6bcafbddd970016c48d0fee95885cc00cecd0ec6 [file] [log] [blame]
From foo@baz Mon Nov 6 10:07:35 CET 2017
From: Boris Brezillon <boris.brezillon@free-electrons.com>
Date: Sat, 7 Oct 2017 22:36:52 +0000
Subject: mtd: nand: sunxi: Fix the non-polling case in sunxi_nfc_wait_events()
From: Boris Brezillon <boris.brezillon@free-electrons.com>
[ Upstream commit 19649e2c16fbc94b664f7074ec4fa9f15292fdce ]
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@free-electrons.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mtd/nand/sunxi_nand.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -320,6 +320,10 @@ static int sunxi_nfc_wait_events(struct
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 {