Skip to content

Commit eeba55c

Browse files
committed
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: 7938822 ("env: Drop common init() functions") Tested-by: Marek Vasut <[email protected]> Reported-by: Marek Vasut <[email protected]> Reported-by: Andy Shevchenko <[email protected]> Signed-off-by: Tom Rini <[email protected]> --- Changes in v3: - Actually include changes for env/nowhere.c
1 parent f1a7ba1 commit eeba55c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

env/env.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ int env_init(void)
138138
ret = drv->init();
139139
if (ret == -ENOENT) {
140140
gd->env_addr = (ulong)&default_environment[0];
141-
gd->env_valid = 0;
141+
gd->env_valid = ENV_VALID;
142142

143143
return 0;
144144
} else if (ret) {

env/nowhere.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@
1515

1616
DECLARE_GLOBAL_DATA_PTR;
1717

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+
1830
U_BOOT_ENV_LOCATION(nowhere) = {
1931
.location = ENVL_NOWHERE,
32+
.init = env_nowhere_init,
2033
ENV_NAME("nowhere")
2134
};

0 commit comments

Comments
 (0)