From 8690f4862df25ba35f3c0aa807d968a9c08973f4 Mon Sep 17 00:00:00 2001 From: Dmitry Katsubo Date: Sat, 9 Jan 2021 01:55:36 +0100 Subject: [PATCH] Fix misc. warnings (#20715) --- Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp | 5 ++--- Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp | 5 ++--- Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp index 59734bfbfe..decf74e6e9 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp @@ -43,10 +43,9 @@ static bool isDataProc(uint32_t instr) { } UnwResult UnwStartArm(UnwState * const state) { - bool found = false; uint16_t t = UNW_MAX_INSTR_COUNT; - do { + for (;;) { uint32_t instr; /* Attempt to read the instruction */ @@ -527,7 +526,7 @@ UnwResult UnwStartArm(UnwState * const state) { if (--t == 0) return UNWIND_EXHAUSTED; - } while (!found); + } return UNWIND_UNSUPPORTED; } diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp index be4abd090f..0c6a70649d 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp @@ -30,12 +30,11 @@ static int32_t signExtend11(const uint16_t value) { } UnwResult UnwStartThumb(UnwState * const state) { - bool found = false; uint16_t t = UNW_MAX_INSTR_COUNT; uint32_t lastJumpAddr = 0; // Last JUMP address, to try to detect infinite loops bool loopDetected = false; // If a loop was detected - do { + for (;;) { uint16_t instr; /* Attempt to read the instruction */ @@ -1059,7 +1058,7 @@ UnwResult UnwStartThumb(UnwState * const state) { if (--t == 0) return UNWIND_EXHAUSTED; - } while (!found); + } return UNWIND_SUCCESS; } diff --git a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp index f97a323350..b3e579e6a4 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp @@ -245,9 +245,8 @@ u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire = { u8g_dev_ssd1306_128x64_2x_2_w uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq) { uint8_t is_escape = 0; - uint8_t value; for (;;) { - value = u8g_pgm_read(esc_seq); + uint8_t value = u8g_pgm_read(esc_seq); if (is_escape == 0) { if (value != 255) { if (u8g_WriteByte(u8g, dev, value) == 0 )