[PATCH 2/3] mtd: m25p80: handle failed spi_write in m25p80_erase

Heiner Kallweit hkallweit1 at gmail.com
Tue Nov 17 11:18:31 PST 2015


Handle the case that spi_write fails.

Signed-off-by: Heiner Kallweit <hkallweit1 at gmail.com>
---
 drivers/mtd/devices/m25p80.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 634b0c4..f10daa8 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -171,9 +171,7 @@ static int m25p80_erase(struct spi_nor *nor, loff_t offset)
 	flash->command[0] = nor->erase_opcode;
 	m25p_addr2cmd(nor, offset, flash->command);
 
-	spi_write(flash->spi, flash->command, m25p_cmdsz(nor));
-
-	return 0;
+	return spi_write(flash->spi, flash->command, m25p_cmdsz(nor));
 }
 
 /*
-- 
2.6.2




More information about the linux-mtd mailing list