[PATCH 2/8] mtd: spi-nor: handle timeout errors in spi_nor_write()
Brian Norris
computersforpeace at gmail.com
Wed Aug 6 18:16:56 PDT 2014
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 at gmail.com>
---
drivers/mtd/spi-nor/spi-nor.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 5825b8a12cee..d77c93232b76 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -809,7 +809,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);
@@ -818,7 +821,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)
--
1.9.1
More information about the linux-mtd
mailing list