summaryrefslogtreecommitdiff
path: root/env/nowhere.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-08-19 22:27:57 -0400
committerTom Rini <trini@konsulko.com>2017-08-20 19:27:28 -0400
commiteeba55cb4a8a29a47d0d26692c188b47ba6bf396 (patch)
treeec04faf5e627094cb02d4ad9afd7286f4c7798e8 /env/nowhere.c
parentf1a7ba1da5f2a8ddaa4f61c7d9fb79ade5425f0f (diff)
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
Diffstat (limited to 'env/nowhere.c')
-rw-r--r--env/nowhere.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/env/nowhere.c b/env/nowhere.c
index d60de494e6..f654883c8a 100644
--- a/env/nowhere.c
+++ b/env/nowhere.c
@@ -15,7 +15,20 @@
DECLARE_GLOBAL_DATA_PTR;
+/*
+ * Because we only ever have the default environment available we must mark
+ * it as invalid.
+ */
+static int env_nowhere_init(void)
+{
+ gd->env_addr = (ulong)&default_environment[0];
+ gd->env_valid = ENV_INVALID;
+
+ return 0;
+}
+
U_BOOT_ENV_LOCATION(nowhere) = {
.location = ENVL_NOWHERE,
+ .init = env_nowhere_init,
ENV_NAME("nowhere")
};