summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorBen Avison <[email protected]>2022-09-05 12:53:49 +0100
committerBen Avison <[email protected]>2022-09-13 18:00:50 +0100
commit65ba15c37d50fa470fa24c38dbf0e30eba3147c0 (patch)
tree0a256668b5f4e70d9a1d5669d41027ed3c4ba9d0 /src/class
parent16518dcbbb6f20182a6f69556908afe35a7f6e25 (diff)
Remove unreachable code
IAR generates warning Pe111 'statement is unreachable'. In a couple of cases, replace return statements with TU_ATTR_FALLTHROUGH; because some compilers apparently can't figure out that the return statements are unreachable but do whinge about an imagined fall-through without them!
Diffstat (limited to 'src/class')
-rw-r--r--src/class/usbtmc/usbtmc_device.c10
-rw-r--r--src/class/video/video_device.c1
2 files changed, 3 insertions, 8 deletions
diff --git a/src/class/usbtmc/usbtmc_device.c b/src/class/usbtmc/usbtmc_device.c
index af4a92732..64db85fcf 100644
--- a/src/class/usbtmc/usbtmc_device.c
+++ b/src/class/usbtmc/usbtmc_device.c
@@ -496,7 +496,6 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
default:
usbd_edpt_stall(rhport, usbtmc_state.ep_bulk_out);
TU_VERIFY(false);
- return false;
}
return true;
@@ -509,8 +508,8 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
return true;
case STATE_ABORTING_BULK_OUT:
- TU_VERIFY(false);
- return false; // Should be stalled by now, shouldn't have received a packet.
+ TU_VERIFY(false); // Should be stalled by now, shouldn't have received a packet.
+ TU_ATTR_FALLTHROUGH; // Not really - some compilers can't figure out that the above macro always returns.
case STATE_TX_REQUESTED:
case STATE_TX_INITIATED:
@@ -567,7 +566,6 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
default:
TU_ASSERT(false);
- return false;
}
}
else if (ep_addr == usbtmc_state.ep_int_in) {
@@ -872,15 +870,13 @@ bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request
{
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
TU_VERIFY(false);
- return false;
+ TU_ATTR_FALLTHROUGH; // Not really - some compilers can't figure out that the above macro always returns.
}
#endif
default:
TU_VERIFY(false);
- return false;
}
- TU_VERIFY(false);
}
#endif /* CFG_TUD_TSMC */
diff --git a/src/class/video/video_device.c b/src/class/video/video_device.c
index 1f653f5c5..a27287360 100644
--- a/src/class/video/video_device.c
+++ b/src/class/video/video_device.c
@@ -943,7 +943,6 @@ static int handle_video_stm_req(uint8_t rhport, uint8_t stage,
default: return VIDEO_ERROR_INVALID_REQUEST;
}
- return VIDEO_ERROR_UNKNOWN;
}
//--------------------------------------------------------------------+