Skip to content

Commit 5bfb5bf

Browse files
committed
Remove statement is unreachable warning in MbedCRC.h
The code removed appears unnecessary given that the switch case below also handles the case where the polynomial is `POLY_32BIT_REV_ANSI`
1 parent 01bb1b9 commit 5bfb5bf

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

drivers/MbedCRC.h

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -514,22 +514,19 @@ class MbedCRC {
514514
MBED_STATIC_ASSERT(width <= 32, "Max 32-bit CRC supported");
515515

516516
#if DEVICE_CRC
517-
if (POLY_32BIT_REV_ANSI == polynomial) {
518-
_crc_table = (uint32_t *)Table_CRC_32bit_Rev_ANSI;
519-
_mode = TABLE;
520-
return;
521-
}
522-
crc_mbed_config_t config;
523-
config.polynomial = polynomial;
524-
config.width = width;
525-
config.initial_xor = _initial_value;
526-
config.final_xor = _final_xor;
527-
config.reflect_in = _reflect_data;
528-
config.reflect_out = _reflect_remainder;
529-
530-
if (hal_crc_is_supported(&config)) {
531-
_mode = HARDWARE;
532-
return;
517+
if (POLY_32BIT_REV_ANSI != polynomial) {
518+
crc_mbed_config_t config;
519+
config.polynomial = polynomial;
520+
config.width = width;
521+
config.initial_xor = _initial_value;
522+
config.final_xor = _final_xor;
523+
config.reflect_in = _reflect_data;
524+
config.reflect_out = _reflect_remainder;
525+
526+
if (hal_crc_is_supported(&config)) {
527+
_mode = HARDWARE;
528+
return;
529+
}
533530
}
534531
#endif
535532

0 commit comments

Comments
 (0)