[PATCH 2/3] defaultenv: don't abort defaultenv_load silently on error
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Nov 24 09:59:41 PST 2025
Failure to load one defaultenv has no bearing on whether subsequent
defaultenv loads would succeed, so do not abort the loop early in that
case.
Reported-by: Jan Lübbe <j.luebbe at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/startup.c | 8 ++++++--
defaultenv/defaultenv.c | 8 ++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/common/startup.c b/common/startup.c
index dfea8394fdee..8f5e77d4619c 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -92,8 +92,12 @@ static int load_environment(void)
default_environment_path = default_environment_path_get();
- if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT))
- defaultenv_load("/env", 0);
+ if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) {
+ ret = defaultenv_load("/env", 0);
+ if (ret)
+ pr_warn("Failed loading (some) defaultenv overlays: %pe\n",
+ ERR_PTR(ret));
+ }
if (IS_ENABLED(CONFIG_ENV_HANDLING)) {
envfs_load(default_environment_path, "/env", 0);
diff --git a/defaultenv/defaultenv.c b/defaultenv/defaultenv.c
index 652fda05027a..8407a2457630 100644
--- a/defaultenv/defaultenv.c
+++ b/defaultenv/defaultenv.c
@@ -177,17 +177,17 @@ static int defaultenv_load_one(struct defaultenv *df, const char *dir,
int defaultenv_load(const char *dir, unsigned flags)
{
struct defaultenv *df;
- int ret;
+ int err = 0;
defaultenv_add_base();
defaultenv_add_external();
list_for_each_entry(df, &defaultenv_list, list) {
- ret = defaultenv_load_one(df, dir, flags);
+ int ret = defaultenv_load_one(df, dir, flags);
if (ret)
- return ret;
+ err = ret;
}
- return 0;
+ return err;
}
--
2.47.3
More information about the barebox
mailing list