Skip to contentSkip to conversation

hw/block/onenand: Remove dead code block

PATCH Applied Thomas Huth 3 participants 3 messages Oct 3, 2017 – Oct 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/block/onenand: Remove dead code block

The condition of the for-loop makes sure that b is always smaller than s->blocks, so the "if (b >= s->blocks)" statement is completely superfluous here.

---
 hw/block/onenand.c | 4 ----
 1 file changed, 4 deletions(-)
hw/block/onenand.c +0 -4
index 30e40f3..de65c9e 100644
@@ -520,10 +520,6 @@ static void onenand_command(OneNANDState *s)
         s->intstatus |= ONEN_INT;
 
         for (b = 0; b < s->blocks; b ++) {
-            if (b >= s->blocks) {
-                s->status |= ONEN_ERR_CMD;
-                break;
-            }
             if (s->blockwp[b] == ONEN_LOCK_LOCKTIGHTEN)
                 break;
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Thomas Huth

The condition of the for-loop makes sure that b is always smaller than s->blocks, so the "if (b >= s->blocks)" statement is completely superfluous here.

---
 hw/block/onenand.c | 4 ----
 1 file changed, 4 deletions(-)
hw/block/onenand.c +0 -0
index 30e40f3..de65c9e 100644

hw/block/onenand.c static void onenand_command(OneNANDState *s) · line 525

Quoted 10 lines
hw/block/onenand.c +0 -4
@@ -520,10 +520,6 @@ static void onenand_command(OneNANDState *s)
         s->intstatus |= ONEN_INT;
 
         for (b = 0; b < s->blocks; b ++) {
-            if (b >= s->blocks) {
-                s->status |= ONEN_ERR_CMD;
-                break;
-            }
             if (s->blockwp[b] == ONEN_LOCK_LOCKTIGHTEN)
                 break;
 

Looks like a bad cut'n'paste from case 0x23.

Applied
#2 lore raw

Am 03.10.2017 um 12:25 hat Laurent Vivier geschrieben:

Quoted 30 lines · Thomas Huth
Quoted 16 lines

The condition of the for-loop makes sure that b is always smaller than s->blocks, so the "if (b >= s->blocks)" statement is completely superfluous here.

---
 hw/block/onenand.c | 4 ----
 1 file changed, 4 deletions(-)
hw/block/onenand.c +0 -0
index 30e40f3..de65c9e 100644

hw/block/onenand.c static void onenand_command(OneNANDState *s) · line 525

Quoted 10 lines
hw/block/onenand.c +0 -4
@@ -520,10 +520,6 @@ static void onenand_command(OneNANDState *s)
         s->intstatus |= ONEN_INT;
 
         for (b = 0; b < s->blocks; b ++) {
-            if (b >= s->blocks) {
-                s->status |= ONEN_ERR_CMD;
-                break;
-            }
             if (s->blockwp[b] == ONEN_LOCK_LOCKTIGHTEN)
                 break;
 

Looks like a bad cut'n'paste from case 0x23.

Quoted 1 line

Thanks, applied to the block branch.

Kevin