layerscape: add 64b/32b target for ls1012ardb device
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 1084-mtd-spi-nor-fix-error-handling-in-spi_nor_erase.patch
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
5
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.
9
10 Currently the callback isn't called in case of failure. Fix this.
11
12 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
13 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
14 ---
15 drivers/mtd/spi-nor/spi-nor.c | 8 ++------
16 1 file changed, 2 insertions(+), 6 deletions(-)
17
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
21
22 write_disable(nor);
23
24 +erase_err:
25 spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE);
26
27 - instr->state = MTD_ERASE_DONE;
28 + instr->state = ret ? MTD_ERASE_FAILED : MTD_ERASE_DONE;
29 mtd_erase_callback(instr);
30
31 return ret;
32 -
33 -erase_err:
34 - spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE);
35 - instr->state = MTD_ERASE_FAILED;
36 - return ret;
37 }
38
39 static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs,