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>
This commit is contained in:
Brian Norris 2014-08-06 18:16:56 -07:00
parent 51983b7dcf
commit 1d61dcb3ff
1 changed files with 5 additions and 2 deletions

View File

@ -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)