Skip to contentSkip to conversation

sf: Read status and flag status code cleanup

PATCH New Zhiqiang Hou 2 participants 2 messages Aug 18, 2015 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sf: Read status and flag status code cleanup

From: Hou Zhiqiang <[email protected]>

It doesn't make sense to compare a 'u8' element with Zero.

---
 drivers/mtd/spi/sf_ops.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/mtd/spi/sf_ops.c +2 -8
index a5487ad..ba5ff0c 100644
@@ -162,10 +162,7 @@ static inline int spi_flash_sr_ready(struct spi_flash *flash)
 	if (ret < 0)
 		return ret;
 
-	if (sr < 0)
-		return sr;
-	else
-		return !(sr & STATUS_WIP);
+	return !(sr & STATUS_WIP);
 }
 
 static inline int spi_flash_fsr_ready(struct spi_flash *flash)
@@ -177,10 +174,7 @@ static inline int spi_flash_fsr_ready(struct spi_flash *flash)
 	if (ret < 0)
 		return ret;
 
-	if (fsr < 0)
-		return fsr;
-	else
-		return fsr & STATUS_PEC;
+	return fsr & STATUS_PEC;
 }
 
 static int spi_flash_ready(struct spi_flash *flash)
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw

PATCH 1/1 sf: Read status and flag status code cleanup

Quoted 5 lines · Zhiqiang Hou

From: Hou Zhiqiang <[email protected]>

It doesn't make sense to compare a 'u8' element with Zero.

Quoted 33 lines
---
 drivers/mtd/spi/sf_ops.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/mtd/spi/sf_ops.c +2 -9
index a5487ad..ba5ff0c 100644
@@ -162,10 +162,7 @@ static inline int spi_flash_sr_ready(struct spi_flash *flash)
        if (ret < 0)
                return ret;
 
-       if (sr < 0)
-               return sr;
-       else
-               return !(sr & STATUS_WIP);
+       return !(sr & STATUS_WIP);
 }
 
 static inline int spi_flash_fsr_ready(struct spi_flash *flash)
@@ -177,10 +174,7 @@ static inline int spi_flash_fsr_ready(struct spi_flash *flash)
        if (ret < 0)
                return ret;
 
-       if (fsr < 0)
-               return fsr;
-       else
-               return fsr & STATUS_PEC;
+       return fsr & STATUS_PEC;
 }
 
 static int spi_flash_ready(struct spi_flash *flash)
--
Quoted 1 line

2.1.0.27.g96db324

thanks!

Signature · 1 line
Jagan | openedev.