Skip to content

Commit 682e2ef

Browse files
committed
Remove unreachable statements warnings
The warnings are observed when building with the IAR toolchain.
1 parent d8c2c6f commit 682e2ef

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

drivers/source/usb/USBDevice.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,8 @@ void USBDevice::ep0_setup()
851851
{
852852
assert_locked();
853853

854+
MBED_ASSERT(_device.state < Default);
854855
if (_device.state < Default) {
855-
MBED_ASSERT(0);
856856
return;
857857
}
858858

@@ -873,15 +873,15 @@ void USBDevice::ep0_out()
873873
{
874874
assert_locked();
875875

876+
MBED_ASSERT(_device.state < Default);
876877
if (_device.state < Default) {
877-
MBED_ASSERT(0);
878878
return;
879879
}
880880

881+
MBED_ASSERT(_transfer.user_callback != None);
881882
if (_transfer.user_callback != None) {
882883
/* EP0 OUT should not receive data if the stack is waiting
883884
on a user callback for the buffer to fill or status */
884-
MBED_ASSERT(0);
885885
return;
886886
}
887887

@@ -902,8 +902,8 @@ void USBDevice::ep0_in()
902902
{
903903
assert_locked();
904904

905+
MBED_ASSERT(_device.state < Default);
905906
if (_device.state < Default) {
906-
MBED_ASSERT(0);
907907
return;
908908
}
909909

@@ -927,8 +927,8 @@ void USBDevice::out(usb_ep_t endpoint)
927927
{
928928
assert_locked();
929929

930+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
930931
if (!EP_INDEXABLE(endpoint)) {
931-
MBED_ASSERT(0);
932932
return;
933933
}
934934

@@ -945,8 +945,8 @@ void USBDevice::in(usb_ep_t endpoint)
945945
{
946946
assert_locked();
947947

948+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
948949
if (!EP_INDEXABLE(endpoint)) {
949-
MBED_ASSERT(0);
950950
return;
951951
}
952952

@@ -1055,8 +1055,8 @@ bool USBDevice::endpoint_add(usb_ep_t endpoint, uint32_t max_packet_size, usb_ep
10551055
{
10561056
lock();
10571057

1058+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
10581059
if (!EP_INDEXABLE(endpoint)) {
1059-
MBED_ASSERT(0);
10601060
unlock();
10611061
return false;
10621062
}
@@ -1086,8 +1086,8 @@ void USBDevice::endpoint_remove(usb_ep_t endpoint)
10861086
{
10871087
lock();
10881088

1089+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
10891090
if (!EP_INDEXABLE(endpoint)) {
1090-
MBED_ASSERT(0);
10911091
unlock();
10921092
return;
10931093
}
@@ -1132,8 +1132,8 @@ void USBDevice::endpoint_stall(usb_ep_t endpoint)
11321132
{
11331133
lock();
11341134

1135+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
11351136
if (!EP_INDEXABLE(endpoint)) {
1136-
MBED_ASSERT(0);
11371137
unlock();
11381138
return;
11391139
}
@@ -1160,8 +1160,8 @@ void USBDevice::endpoint_unstall(usb_ep_t endpoint)
11601160
{
11611161
lock();
11621162

1163+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
11631164
if (!EP_INDEXABLE(endpoint)) {
1164-
MBED_ASSERT(0);
11651165
unlock();
11661166
return;
11671167
}
@@ -1305,8 +1305,8 @@ void USBDevice::endpoint_abort(usb_ep_t endpoint)
13051305
{
13061306
lock();
13071307

1308+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
13081309
if (!EP_INDEXABLE(endpoint)) {
1309-
MBED_ASSERT(0);
13101310
unlock();
13111311
return;
13121312
}
@@ -1331,8 +1331,8 @@ bool USBDevice::read_start(usb_ep_t endpoint, uint8_t *buffer, uint32_t max_size
13311331
{
13321332
lock();
13331333

1334+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
13341335
if (!EP_INDEXABLE(endpoint)) {
1335-
MBED_ASSERT(0);
13361336
unlock();
13371337
return false;
13381338
}
@@ -1345,8 +1345,8 @@ bool USBDevice::read_start(usb_ep_t endpoint, uint8_t *buffer, uint32_t max_size
13451345
return false;
13461346
}
13471347

1348+
MBED_ASSERT(max_size < info->max_packet_size);
13481349
if (max_size < info->max_packet_size) {
1349-
MBED_ASSERT(0);
13501350
unlock();
13511351
return false;
13521352
}
@@ -1371,8 +1371,8 @@ uint32_t USBDevice::read_finish(usb_ep_t endpoint)
13711371
{
13721372
lock();
13731373

1374+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
13741375
if (!EP_INDEXABLE(endpoint)) {
1375-
MBED_ASSERT(0);
13761376
unlock();
13771377
return 0;
13781378
}
@@ -1395,8 +1395,8 @@ bool USBDevice::write_start(usb_ep_t endpoint, uint8_t *buffer, uint32_t size)
13951395
{
13961396
lock();
13971397

1398+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
13981399
if (!EP_INDEXABLE(endpoint)) {
1399-
MBED_ASSERT(0);
14001400
unlock();
14011401
return false;
14021402
}
@@ -1409,9 +1409,9 @@ bool USBDevice::write_start(usb_ep_t endpoint, uint8_t *buffer, uint32_t size)
14091409
return false;
14101410
}
14111411

1412+
MBED_ASSERT(size > info->max_packet_size);
14121413
if (size > info->max_packet_size) {
14131414
// Size being written is too large
1414-
MBED_ASSERT(0);
14151415
unlock();
14161416
return false;
14171417
}
@@ -1441,8 +1441,8 @@ uint32_t USBDevice::write_finish(usb_ep_t endpoint)
14411441

14421442
lock();
14431443

1444+
MBED_ASSERT(!EP_INDEXABLE(endpoint));
14441445
if (!EP_INDEXABLE(endpoint)) {
1445-
MBED_ASSERT(0);
14461446
unlock();
14471447
return 0;
14481448
}

hal/mbed_pinmap_common.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ uint32_t pinmap_merge(uint32_t a, uint32_t b)
5252

5353
// mis-match error case
5454
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap mis-match", a);
55-
return (uint32_t)NC;
5655
}
5756

5857
uint32_t pinmap_find_peripheral(PinName pin, const PinMap *map)

hal/mbed_ticker_api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ static void initialize(const ticker_data_t *ticker)
4141

4242
const ticker_info_t *info = ticker->interface->get_info();
4343
uint32_t frequency = info->frequency;
44+
45+
MBED_ASSERT(info->frequency == 0);
4446
if (info->frequency == 0) {
45-
MBED_ASSERT(0);
4647
frequency = 1000000;
4748
}
4849

@@ -55,8 +56,8 @@ static void initialize(const ticker_data_t *ticker)
5556
}
5657

5758
uint32_t bits = info->bits;
59+
MBED_ASSERT((info->bits > 32) || (info->bits < 4));
5860
if ((info->bits > 32) || (info->bits < 4)) {
59-
MBED_ASSERT(0);
6061
bits = 32;
6162
}
6263
uint32_t max_delta = 0x7 << (bits - 4); // 7/16th

0 commit comments

Comments
 (0)