summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-09-30 17:42:47 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-10-05 08:30:39 +0200
commita8b788ba61eb813f87cc8b401da662a463a9548c (patch)
tree9545c3256d9712ce5d0c2801f27a32c95a3df5ea /include
parent4ef08098b6d21b20eea76233ede13dc0142e3fab (diff)
downloadbarebox-a8b788ba61eb813f87cc8b401da662a463a9548c.tar.gz
barebox-a8b788ba61eb813f87cc8b401da662a463a9548c.tar.xz
relocate_to_current_adr: hang directly on error instead of panic()
panic() will format a panic message, turn on a panic LED, dump a stack trace and finally either restart the system or print a message to ask the user to restart the system before hanging. When relocation fails, all of these aren't possible, so instead of devolving into undefined behavior, fall directly into an infinite loop. Motivation for this change is to avoid linking printf code when it's only usage is the relocation error case. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220930154247.756577-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/common.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index bd12035688..cf3e0447a0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -43,6 +43,12 @@
*/
void reginfo(void);
+/* For use when unrelocated */
+static inline void __hang(void)
+{
+ while (1);
+}
+
void __noreturn hang (void);
char *size_human_readable(unsigned long long size);