1 From 9e473594776da97245049019f1d1e9608ff1214a Mon Sep 17 00:00:00 2001
2 From: Heiner Kallweit <hkallweit1@gmail.com>
3 Date: Tue, 17 Nov 2015 20:18:54 +0100
4 Subject: [PATCH 084/113] mtd: spi-nor: fix error handling in spi_nor_erase
6 The documenting comment of mtd_erase in mtdcore.c states:
7 Device drivers are supposed to call instr->callback() whenever
8 the operation completes, even if it completes with a failure.
10 Currently the callback isn't called in case of failure. Fix this.
12 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
13 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
15 drivers/mtd/spi-nor/spi-nor.c | 8 ++------
16 1 file changed, 2 insertions(+), 6 deletions(-)
18 --- a/drivers/mtd/spi-nor/spi-nor.c
19 +++ b/drivers/mtd/spi-nor/spi-nor.c
20 @@ -410,17 +410,13 @@ static int spi_nor_erase(struct mtd_info
25 spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE);
27 - instr->state = MTD_ERASE_DONE;
28 + instr->state = ret ? MTD_ERASE_FAILED : MTD_ERASE_DONE;
29 mtd_erase_callback(instr);
34 - spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE);
35 - instr->state = MTD_ERASE_FAILED;
39 static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs,