Commit eeba55cb4a8a29a47d0d26692c188b47ba6bf396
1 parent
f1a7ba1da5
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
env: Correct case of no sub-init function
With the change to the environment code to remove the common init stage of pointing to the default environment and setting it as valid, combined with the change to switch gd->env_valid from 0/1/2 to an enum we now must set env_valid to one of the enum values rather than an int. And in this case, not only was setting it to an int wrong, it was now the wrong value. Finally, in the case of ENV_IS_NOWHERE we must still say that our envionrment is invalid after init for things to continue to function. Fixes: 7938822a6b75 ("env: Drop common init() functions") Tested-by: Marek Vasut <marek.vasut@gmail.com> Reported-by: Marek Vasut <marek.vasut@gmail.com> Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com> --- Changes in v3: - Actually include changes for env/nowhere.c
Showing 2 changed files with 14 additions and 1 deletions Side-by-side Diff
env/env.c
env/nowhere.c
... | ... | @@ -15,8 +15,21 @@ |
15 | 15 | |
16 | 16 | DECLARE_GLOBAL_DATA_PTR; |
17 | 17 | |
18 | +/* | |
19 | + * Because we only ever have the default environment available we must mark | |
20 | + * it as invalid. | |
21 | + */ | |
22 | +static int env_nowhere_init(void) | |
23 | +{ | |
24 | + gd->env_addr = (ulong)&default_environment[0]; | |
25 | + gd->env_valid = ENV_INVALID; | |
26 | + | |
27 | + return 0; | |
28 | +} | |
29 | + | |
18 | 30 | U_BOOT_ENV_LOCATION(nowhere) = { |
19 | 31 | .location = ENVL_NOWHERE, |
32 | + .init = env_nowhere_init, | |
20 | 33 | ENV_NAME("nowhere") |
21 | 34 | }; |