diff options
author | Patrick Georgi <pgeorgi@google.com> | 2017-10-29 07:42:37 -0400 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-03 23:05:10 +0000 |
commit | 5479fd588e957f54abb499bfd71e042a8d671625 (patch) | |
tree | 734d54cf951af3022106c415f53cf4a720fca5d0 /chip | |
parent | 61225c744086c75688bcbdb9e91607a1d1c28acd (diff) | |
download | chrome-ec-5479fd588e957f54abb499bfd71e042a8d671625.tar.gz |
Mark reset and panic functions as noreturn
gcc 6.3 (as provided by coreboot-sdk) needs that to know which code
paths end early.
Also add a loop after the command that is "supposed" to reset the
machine so that the compiler believes it (and in case that assumption
fails).
BRANCH=none
BUG=b:65441143
TEST=none
Change-Id: Idb87253ec7880d66ffec30d75f4d007f02f63aab
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/742916
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
(cherry picked from commit 887e3962ca19cc7e8c3c474f8c82b4240eb63416)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229786
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Commit-Queue: Mary Ruthven <mruthven@chromium.org>
(cherry picked from commit d9a7a641f1ba2763d46b996056a24574942be01d)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3260166
Diffstat (limited to 'chip')
-rw-r--r-- | chip/g/system.c | 3 | ||||
-rw-r--r-- | chip/host/reboot.c | 3 | ||||
-rw-r--r-- | chip/host/reboot.h | 1 | ||||
-rw-r--r-- | chip/mec1322/system.c | 1 |
4 files changed, 7 insertions, 1 deletions
diff --git a/chip/g/system.c b/chip/g/system.c index da14c3fbed..8e7b0d03cb 100644 --- a/chip/g/system.c +++ b/chip/g/system.c @@ -170,7 +170,8 @@ void system_reset(int flags) #endif /* ^^^^^^^ CHIP_FAMILY_CR50 Not defined */ /* Wait for reboot; should never return */ - asm("wfi"); + while (1) + asm("wfi"); } const char *system_get_chip_vendor(void) diff --git a/chip/host/reboot.c b/chip/host/reboot.c index 526276aede..7fdb6f7f8e 100644 --- a/chip/host/reboot.c +++ b/chip/host/reboot.c @@ -12,9 +12,12 @@ #include "reboot.h" #include "test_util.h" +__attribute__((noreturn)) void emulator_reboot(void) { char *argv[] = {strdup(__get_prog_name()), NULL}; emulator_flush(); execv(__get_prog_name(), argv); + while (1) + ; } diff --git a/chip/host/reboot.h b/chip/host/reboot.h index e391866497..113569bb9b 100644 --- a/chip/host/reboot.h +++ b/chip/host/reboot.h @@ -8,6 +8,7 @@ #ifndef __CROS_EC_REBOOT_H #define __CROS_EC_REBOOT_H +__attribute__((noreturn)) void emulator_reboot(void); #endif diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c index a3262944ac..50f2ed973a 100644 --- a/chip/mec1322/system.c +++ b/chip/mec1322/system.c @@ -96,6 +96,7 @@ void chip_save_reset_flags(int flags) MEC1322_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS) = flags; } +__attribute__((noreturn)) void _system_reset(int flags, int wake_from_hibernate) { uint32_t save_flags = 0; |