diff options
author | Brian Norris <computersforpeace@gmail.com> | 2014-08-06 18:16:56 -0700 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-11-05 02:02:20 -0800 |
commit | 1d61dcb3ff5e4713d242a539947d8dd650ab3014 (patch) | |
tree | d61febf46b37778e65a2eb7d524adb1fae5acc67 /drivers/mtd | |
parent | 51983b7dcf3a50f4fdf6353235cd520e6c946e5a (diff) |
mtd: spi-nor: handle timeout errors in spi_nor_write()
The error label was unused here. It looks like we're missing at least
one case that should be doing 'goto write_err'.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <shijie8@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/spi-nor/spi-nor.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index c66de2fc89d..b62d9d00c30 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -805,7 +805,10 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, if (page_size > nor->page_size) page_size = nor->page_size; - wait_till_ready(nor); + ret = wait_till_ready(nor); + if (ret) + goto write_err; + write_enable(nor); nor->write(nor, to + i, page_size, retlen, buf + i); @@ -814,7 +817,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, write_err: spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); - return 0; + return ret; } static int macronix_quad_enable(struct spi_nor *nor) |