Skip to contentSkip to conversation

mtd: m25p80: handle failed spi_write in m25p80_erase

PATCH In review Heiner Kallweit 4 participants 5 messages Oct 7, 2015 – Nov 29, 2015 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: m25p80: handle failed spi_write in m25p80_erase

Return an error if spi_write fails.

---
 drivers/mtd/devices/m25p80.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/devices/m25p80.c +1 -3
index 634b0c4..f10daa8 100644
@@ -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));
 }
 
 /*
Signature · 1 line
2.6.1
#1 lore raw
Quoted 12 lines · Heiner Kallweit

Return an error if spi_write fails.

---
 drivers/mtd/devices/m25p80.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/devices/m25p80.c +0 -0
index 634b0c4..f10daa8 100644

drivers/mtd/devices/m25p80.c static int m25p80_erase(struct spi_nor *nor, loff_t offset) · line 177

Quoted 10 lines
drivers/mtd/devices/m25p80.c +1 -3
@@ -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));
 }
 
 /*

m25p80_erase() has been dropped, as it can be implemented in spi-nor.c, with calls only to ->write_reg(). This error handling is done correctly there. See:

cd78ea02dc82 ("mtd: m25p80: drop erase() callback") c67cbb839da9 ("mtd: spi-nor: provide default erase_sector implementation")

Brian

#2 lore raw

Hello,

Quoted 22 lines · Brian Norris
Quoted 21 lines · Heiner Kallweit

Return an error if spi_write fails.

---
 drivers/mtd/devices/m25p80.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/devices/m25p80.c +1 -3
index 634b0c4..f10daa8 100644
@@ -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));
 }
 
Quoted 9 lines

drivers/mtd/devices/m25p80.c static int m25p80_erase(struct spi_nor *nor, loff_t offset) · line 177

Quoted 1 line
drivers/mtd/devices/m25p80.c +0 -0
 /*

m25p80_erase() has been dropped, as it can be implemented in spi-nor.c, with calls only to ->write_reg(). This error handling is done correctly there. See:

cd78ea02dc82 ("mtd: m25p80: drop erase() callback") c67cbb839da9 ("mtd: spi-nor: provide default erase_sector implementation")

Where are these patches applied?

I wrote exact same patch as above and it still applies to Linux master.

Thanks

Michal

#3 lore raw
Quoted 31 lines · Michal Suchanek

Hello,

Quoted 28 lines · Brian Norris
Quoted 12 lines · Heiner Kallweit

Return an error if spi_write fails.

---
 drivers/mtd/devices/m25p80.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/devices/m25p80.c +0 -0
index 634b0c4..f10daa8 100644

drivers/mtd/devices/m25p80.c static int m25p80_erase(struct spi_nor *nor, loff_t offset) · line 177

Quoted 10 lines
drivers/mtd/devices/m25p80.c +1 -3
@@ -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));
 }
 
 /*

m25p80_erase() has been dropped, as it can be implemented in spi-nor.c, with calls only to ->write_reg(). This error handling is done correctly there. See:

Quoted 6 lines
Quoted 3 lines

cd78ea02dc82 ("mtd: m25p80: drop erase() callback") c67cbb839da9 ("mtd: spi-nor: provide default erase_sector implementation")

Where are these patches applied?

As per [1] latest MTD patches are in http://git.infradead.org/l2-mtd.git.

[1] http://www.linux-mtd.infradead.org/source.html

Signature · 2 lines
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
#4 lore raw
Quoted 36 lines · Ezequiel Garcia
Quoted 35 lines · Michal Suchanek

Hello,

Quoted 31 lines · Brian Norris
Quoted 12 lines · Heiner Kallweit

Return an error if spi_write fails.

---
 drivers/mtd/devices/m25p80.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/devices/m25p80.c +0 -0
index 634b0c4..f10daa8 100644

drivers/mtd/devices/m25p80.c static int m25p80_erase(struct spi_nor *nor, loff_t offset) · line 177

Quoted 10 lines
drivers/mtd/devices/m25p80.c +1 -3
@@ -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));
 }
 
 /*

m25p80_erase() has been dropped, as it can be implemented in spi-nor.c, with calls only to ->write_reg(). This error handling is done correctly there. See:

cd78ea02dc82 ("mtd: m25p80: drop erase() callback") c67cbb839da9 ("mtd: spi-nor: provide default erase_sector implementation")

Quoted 7 lines
Quoted 2 lines

Where are these patches applied?

As per [1] latest MTD patches are in http://git.infradead.org/l2-mtd.git.

[1] http://www.linux-mtd.infradead.org/source.html

Yes, that has those patches.

Thanks

Michal