fix a lot of nuisances reported by cppcheck (#4872)

* fix a lot of nuisances reported by cppcheck

* fix portduino
This commit is contained in:
Thomas Göttgens
2024-09-26 02:09:06 +02:00
committed by GitHub
parent 118809fbfc
commit 12481b568a
18 changed files with 33 additions and 35 deletions

View File

@@ -48,11 +48,10 @@ extern "C" void bootloader_util_app_start(uint32_t start_addr);
static uint16_t crc16(const uint8_t *data_p, uint8_t length)
{
uint8_t x;
uint16_t crc = 0xFFFF;
while (length--) {
x = crc >> 8 ^ *data_p++;
uint8_t x = crc >> 8 ^ *data_p++;
x ^= x >> 4;
crc = (crc << 8) ^ ((uint16_t)(x << 12)) ^ ((uint16_t)(x << 5)) ^ ((uint16_t)x);
}