summaryrefslogtreecommitdiffstats
path: root/common/startup.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-06-25 10:56:14 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-06-26 08:41:02 +0200
commit73d2e0b7343d6a22d4b47499a3edf209cea60ccc (patch)
tree4d83149234d9f08d1381aca1a99cd68b215704fe /common/startup.c
parent8628b5881418c23a22d72319b76ab04b7ec644f9 (diff)
downloadbarebox-73d2e0b7343d6a22d4b47499a3edf209cea60ccc.tar.gz
barebox-73d2e0b7343d6a22d4b47499a3edf209cea60ccc.tar.xz
startup: Fix do_autoboot_countdown() running multiple times
The comment above do_autoboot_countdown() states: "This function can be called multiple times, it is executed only the first time.". Since 1973892533 ("startup: don't clobber original autoboot state") This is no longer the case. Bring back the old and documented behaviour. Fixes: 1973892533 ("startup: don't clobber original autoboot state") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/startup.c')
-rw-r--r--common/startup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/startup.c b/common/startup.c
index 7e0f7d6b64..71a28a7be8 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -235,7 +235,7 @@ void set_autoboot_state(enum autoboot_state autoboot)
*/
enum autoboot_state do_autoboot_countdown(void)
{
- enum autoboot_state autoboot_state;
+ static enum autoboot_state autoboot_state = AUTOBOOT_UNKNOWN;
unsigned flags = CONSOLE_COUNTDOWN_EXTERN;
int ret;
struct stat s;
@@ -243,6 +243,9 @@ enum autoboot_state do_autoboot_countdown(void)
char *abortkeys = NULL;
unsigned char outkey;
+ if (autoboot_state != AUTOBOOT_UNKNOWN)
+ return autoboot_state;
+
if (global_autoboot_state != AUTOBOOT_COUNTDOWN)
return global_autoboot_state;