mtd: nand: sunxi: Fix the non-polling case in sunxi_nfc_wait_events()
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Fri, 6 Jan 2017 09:42:05 +0000 (10:42 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Mon, 6 Feb 2017 08:35:14 +0000 (09:35 +0100)
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>
drivers/mtd/nand/sunxi_nand.c

index e40482a65de6683264950a0caeba55484b1ffedf..ba78e13a3570442c68298b8bb2bd61e3112d50ca 100644 (file)
@@ -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 {