chore(core): simplify conditional compilation in bootutils
What changed, and why it matters
This is a tiny code cleanup in the Trezor firmware's low-level startup code. It rearranges two preprocessor directives (#ifdef) so the logic is simpler, without changing what the compiled code actually does. There is no security-relevant change.
No action required; this is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors conditional compilation in reboot_or_halt_after_rsod(). Previously, systick_delay_ms(10*1000) was excluded under RSOD_INFINITE_LOOP via a separate #ifndef block, and halt_device() was called under #ifdef RSOD_INFINITE_LOOP. The new version places the delay inside the #else branch (non-infinite-loop path) so the two branches are cleanly paired. Functionally identical: when RSOD_INFINITE_LOOP is defined the function calls halt_device() with no delay; otherwise it delays 10 s then reboots. No behavior, timing, or security boundary changes.
Changed components
core/embed/sys/startup/stm32/bootutils.cInspect captured patch +1 / −3
diff --git a/core/embed/sys/startup/stm32/bootutils.c b/core/embed/sys/startup/stm32/bootutils.c
index 9e5043ae..c657ae5e 100644
--- a/core/embed/sys/startup/stm32/bootutils.c
+++ b/core/embed/sys/startup/stm32/bootutils.c
@@ -230,12 +230,10 @@ __attribute__((noreturn)) void reboot_and_wipe(
}
__attribute__((noreturn)) void reboot_or_halt_after_rsod(void) {
-#ifndef RSOD_INFINITE_LOOP
- systick_delay_ms(10 * 1000);
-#endif
#ifdef RSOD_INFINITE_LOOP
halt_device();
#else
+ systick_delay_ms(10 * 1000);
reboot_device();
#endif
}
Why this scored 14/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.