diff mbox

[U-Boot,1/5] altera_qspi: call callback even if the erase failed

Message ID 1450918284-16174-1-git-send-email-thomas@wytron.com.tw
State Accepted, archived
Delegated to: Thomas Chou
Headers show

Commit Message

Thomas Chou Dec. 24, 2015, 12:51 a.m. UTC
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 | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Chou Dec. 28, 2015, 1:34 a.m. UTC | #1
On 2015年12月24日 08:51, Thomas Chou wrote:
> 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 | 1 +
>   1 file changed, 1 insertion(+)
>

Applied to u-boot-nios.
diff mbox

Patch

diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c
index c7e37ad..627a8cc 100644
--- a/drivers/mtd/altera_qspi.c
+++ b/drivers/mtd/altera_qspi.c
@@ -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;