Skip to contentSkip to conversation

hw: Disable code after return statement

PATCH In review Stefan Weil 2 participants 2 messages Sep 23, 2012 – Oct 5, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw: Disable code after return statement

Report from smatch:
microdrive.c:212 md_common_read(34) info: ignoring unreachable code. microdrive.c:273 md_common_write(33) info: ignoring unreachable code. sd.c:343 sd_req_crc_validate(9) info: ignoring unreachable code.

---
 hw/ide/microdrive.c |    3 ++-
 hw/sd.c             |    2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
hw/ide/microdrive.c +2 -1
index 64810f7..07c6f97 100644
@@ -207,7 +207,7 @@ static uint16_t md_common_read(void *opaque, uint32_t at)
     case 0x0:	/* Even RD Data */
     case 0x8:
         return ide_data_readw(&s->bus, 0);
-
+#if 0
         /* TODO: 8-bit accesses */
         if (s->cycle)
             ret = s->io >> 8;
@@ -217,6 +217,7 @@ static uint16_t md_common_read(void *opaque, uint32_t at)
         }
         s->cycle = !s->cycle;
         return ret;
+#endif
     case 0x9:	/* Odd RD Data */
         return s->io >> 8;
     case 0xd:	/* Error */
hw/sd.c +2 -0
index ec26407..62a7751 100644
@@ -340,7 +340,9 @@ static int sd_req_crc_validate(SDRequest *req)
     buffer[3] = (req->arg >> 8) & 0xff;
     buffer[4] = (req->arg >> 0) & 0xff;
     return 0;
+#if 0
     return sd_crc7(buffer, 5) != req->crc;	/* TODO */
+#endif
 }
 
 static void sd_response_r1_make(SDState *sd, uint8_t *response)
Signature · 1 line
1.7.10
#1 lore raw
Quoted 37 lines · Stefan Weil

Report from smatch:
microdrive.c:212 md_common_read(34) info: ignoring unreachable code. microdrive.c:273 md_common_write(33) info: ignoring unreachable code. sd.c:343 sd_req_crc_validate(9) info: ignoring unreachable code.

---
 hw/ide/microdrive.c |    3 ++-
 hw/sd.c             |    2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
hw/ide/microdrive.c +2 -1
index 64810f7..07c6f97 100644
@@ -207,7 +207,7 @@ static uint16_t md_common_read(void *opaque, uint32_t at)
     case 0x0:	/* Even RD Data */
     case 0x8:
         return ide_data_readw(&s->bus, 0);
-
+#if 0
         /* TODO: 8-bit accesses */
         if (s->cycle)
             ret = s->io >> 8;
@@ -217,6 +217,7 @@ static uint16_t md_common_read(void *opaque, uint32_t at)
         }
         s->cycle = !s->cycle;
         return ret;
+#endif
     case 0x9:	/* Odd RD Data */
         return s->io >> 8;
     case 0xd:	/* Error */
hw/sd.c +0 -0
index ec26407..62a7751 100644

hw/sd.c static int sd_req_crc_validate(SDRequest *req) · line 345

Quoted 6 lines
hw/sd.c +2 -0
@@ -340,7 +340,9 @@ static int sd_req_crc_validate(SDRequest *req)
     buffer[3] = (req->arg >> 8) & 0xff;
     buffer[4] = (req->arg >> 0) & 0xff;
     return 0;
+#if 0
     return sd_crc7(buffer, 5) != req->crc;	/* TODO */
+#endif

hw/sd.c:336:13: error: variable ‘buffer’ set but not used [-Werror=unused-but-set-variable]

I suggest we drop this dead code completely instead of using #if 0.

Stefan