Skip to contentSkip to conversation

mtd: spi: don't return -1 when scan succeed

PATCH New Fabien Parent 2 participants 2 messages Dec 5, 2016 – Dec 6, 2016 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: spi: don't return -1 when scan succeed

In spi_flash_scan, 'ret' is initialled to -1, but 'ret' is not always used to store a return value, in that case, even when the function succeed, an error (-1) will be returned.
Lets just return 0 if we hit the end of the function.

---
 drivers/mtd/spi/spi_flash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +2 -2
index 94c0b0063d..41fc0a6a24 100644
@@ -1000,7 +1000,7 @@ int spi_flash_scan(struct spi_flash *flash)
 {
 	struct spi_slave *spi = flash->spi;
 	const struct spi_flash_info *info = NULL;
-	int ret = -1;
+	int ret;
 
 	info = spi_flash_read_id(flash);
 	if (IS_ERR_OR_NULL(info))
@@ -1166,5 +1166,5 @@ int spi_flash_scan(struct spi_flash *flash)
 	}
 #endif
 
-	return ret;
+	return 0;
 }
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 mtd: spi: don't return -1 when scan succeed

Quoted 6 lines · Fabien Parent

In spi_flash_scan, 'ret' is initialled to -1, but 'ret' is not always used to store a return value, in that case, even when the function succeed, an error (-1) will be returned.
Lets just return 0 if we hit the end of the function.

Applied to u-boot-spi/master

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.