mtd: spi-nor: handle timeout errors in spi_nor_write()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Dec 15 19:59:05 PST 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=1d61dcb3ff5e4713d242a539947d8dd650ab3014
Commit:     1d61dcb3ff5e4713d242a539947d8dd650ab3014
Parent:     51983b7dcf3a50f4fdf6353235cd520e6c946e5a
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Wed Aug 6 18:16:56 2014 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Nov 5 02:02:20 2014 -0800

    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 at gmail.com>
    Reviewed-by: Marek Vasut <marex at denx.de>
    Acked-by: Huang Shijie <shijie8 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 c66de2f..b62d9d0 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)



More information about the linux-mtd-cvs mailing list