altera_qspi: call callback even if the erase failed
authorThomas Chou <thomas@wytron.com.tw>
Wed, 23 Dec 2015 02:26:03 +0000 (10:26 +0800)
committerThomas Chou <thomas@wytron.com.tw>
Mon, 28 Dec 2015 01:32:43 +0000 (09:32 +0800)
Erase is an asynchronous operation.  Device drivers are supposed
to call instr->callback() whenever the operation completes, even
if it completes with a failure.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
drivers/mtd/altera_qspi.c

index c7e37add018ab2d522cff3033bff74d4a0ef03e0..627a8ccee374be0d0e738e0b5760e0d15642a848 100644 (file)
@@ -146,6 +146,7 @@ static int altera_qspi_erase(struct mtd_info *mtd, struct erase_info *instr)
                        debug("erase %08x fail %x\n", sect, stat);
                        writel(stat, &regs->isr); /* clear isr */
                        instr->state = MTD_ERASE_FAILED;
+                       mtd_erase_callback(instr);
                        return -EIO;
                }
                addr += mtd->erasesize;