diff options
| author | Tom Rini <[email protected]> | 2023-01-12 10:15:24 -0500 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2023-01-12 10:15:24 -0500 |
| commit | f58885d002302b8047446a6a15f7376bb7b1ea32 (patch) | |
| tree | b87608f2330d6190c3dcfad66eba8e9da5c47de2 /common | |
| parent | ee4f86cc042129abf1b16fcfbf4fc705b03375b6 (diff) | |
| parent | 85fd48984e670d45eddd86710aa47c38baa738ca (diff) | |
Merge branch '2023-01-11-assorted-general-updates'
- Assorted Kconfig cleanups, code clean ups, env+ubi updates, correct
return value propagation out of environment scripts, and update CI to
latest "jammy" tag.
Diffstat (limited to 'common')
| -rw-r--r-- | common/autoboot.c | 4 | ||||
| -rw-r--r-- | common/cli.c | 7 | ||||
| -rw-r--r-- | common/cli_hush.c | 21 |
3 files changed, 21 insertions, 11 deletions
diff --git a/common/autoboot.c b/common/autoboot.c index ea44fdf6add..848c33b2f2a 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -422,7 +422,7 @@ static int abortboot(int bootdelay) return abort; } -static void process_fdt_options(const void *blob) +static void process_fdt_options(void) { #ifdef CONFIG_TEXT_BASE ulong addr; @@ -474,7 +474,7 @@ const char *bootdelay_process(void) s = env_get("bootcmd"); if (IS_ENABLED(CONFIG_OF_CONTROL)) - process_fdt_options(gd->fdt_blob); + process_fdt_options(); stored_bootdelay = bootdelay; return s; diff --git a/common/cli.c b/common/cli.c index a47d6a3f2b4..ba45dad2db5 100644 --- a/common/cli.c +++ b/common/cli.c @@ -146,7 +146,7 @@ int run_commandf(const char *fmt, ...) #if defined(CONFIG_CMD_RUN) int do_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - int i; + int i, ret; if (argc < 2) return CMD_RET_USAGE; @@ -160,8 +160,9 @@ int do_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) return 1; } - if (run_command(arg, flag | CMD_FLAG_ENV) != 0) - return 1; + ret = run_command(arg, flag | CMD_FLAG_ENV); + if (ret) + return ret; } return 0; } diff --git a/common/cli_hush.c b/common/cli_hush.c index a80b84756bb..1ad7a509dfa 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -1901,7 +1901,7 @@ static int run_list_real(struct pipe *pi) last_return_code = -rcode - 2; return -2; /* exit */ } - last_return_code=(rcode == 0) ? 0 : 1; + last_return_code = rcode; #endif #ifndef __U_BOOT__ pi->num_progs = save_num_progs; /* restore number of programs */ @@ -3211,7 +3211,15 @@ static int parse_stream_outer(struct in_str *inp, int flag) printf("exit not allowed from main input shell.\n"); continue; } - break; + /* + * DANGER + * Return code -2 is special in this context, + * it indicates exit from inner pipe instead + * of return code itself, the return code is + * stored in 'last_return_code' variable! + * DANGER + */ + return -2; } if (code == -1) flag_repeat = 0; @@ -3248,9 +3256,9 @@ int parse_string_outer(const char *s, int flag) #endif /* __U_BOOT__ */ { struct in_str input; + int rcode; #ifdef __U_BOOT__ char *p = NULL; - int rcode; if (!s) return 1; if (!*s) @@ -3262,11 +3270,12 @@ int parse_string_outer(const char *s, int flag) setup_string_in_str(&input, p); rcode = parse_stream_outer(&input, flag); free(p); - return rcode; + return rcode == -2 ? last_return_code : rcode; } else { #endif setup_string_in_str(&input, s); - return parse_stream_outer(&input, flag); + rcode = parse_stream_outer(&input, flag); + return rcode == -2 ? last_return_code : rcode; #ifdef __U_BOOT__ } #endif @@ -3286,7 +3295,7 @@ int parse_file_outer(void) setup_file_in_str(&input); #endif rcode = parse_stream_outer(&input, FLAG_PARSE_SEMICOLON); - return rcode; + return rcode == -2 ? last_return_code : rcode; } #ifdef __U_BOOT__ |
