From: Boris Brezillon Date: Fri, 6 Jan 2017 09:42:05 +0000 (+0100) Subject: mtd: nand: sunxi: Fix the non-polling case in sunxi_nfc_wait_events() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=19649e2c16fbc94b664f7074ec4fa9f15292fdce;p=linux.git 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 --- diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c index e40482a65de66..ba78e13a35704 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 {