[U-Boot] [PATCH] sf: call callback even if the mtd erase failed

Thomas Chou thomas at wytron.com.tw
Thu Dec 24 04:40:51 CET 2015


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 at wytron.com.tw>
---
 drivers/mtd/spi/sf_mtd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi/sf_mtd.c b/drivers/mtd/spi/sf_mtd.c
index 0b9cb62..6140a35 100644
--- a/drivers/mtd/spi/sf_mtd.c
+++ b/drivers/mtd/spi/sf_mtd.c
@@ -24,6 +24,7 @@ static int spi_flash_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
 	if (err) {
 		instr->state = MTD_ERASE_FAILED;
 		instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
+		mtd_erase_callback(instr);
 		return -EIO;
 	}
 
-- 
2.5.0



More information about the U-Boot mailing list