From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: "Jan Lübbe" <j.luebbe@pengutronix.de>,
"Ahmad Fatoum" <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] defaultenv: don't abort defaultenv_load silently on error
Date: Mon, 24 Nov 2025 18:59:41 +0100 [thread overview]
Message-ID: <20251124175947.1725563-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251124175947.1725563-1-a.fatoum@pengutronix.de>
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@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@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
next prev parent reply other threads:[~2025-11-24 18:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 17:59 [PATCH 1/3] defaultenv: skip non-existent dirs in defaultenv_append_runtime_directory Ahmad Fatoum
2025-11-24 17:59 ` Ahmad Fatoum [this message]
2025-11-24 17:59 ` [PATCH 3/3] defaultenv: add base and external defaultenv in pure_initcall Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251124175947.1725563-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=j.luebbe@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox