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 v2 3/4] defaultenv: don't abort defaultenv_load silently on error
Date: Tue, 25 Nov 2025 07:23:49 +0100 [thread overview]
Message-ID: <20251125062603.2614867-7-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251125062603.2614867-2-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>
---
v1 -> v2:
- no change
---
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 d6cca466a683..99f681f6520e 100644
--- a/defaultenv/defaultenv.c
+++ b/defaultenv/defaultenv.c
@@ -172,17 +172,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-25 6:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 6:23 [PATCH v2 1/4] fs: qemu_fw_cfg: make use of the automount Ahmad Fatoum
2025-11-25 6:23 ` [PATCH v2 2/4] fs: qemu_fw_cfg: handle non-existent opt/org.barebox.env key gracefully Ahmad Fatoum
2025-11-25 6:23 ` Ahmad Fatoum [this message]
2025-11-25 6:23 ` [PATCH v2 4/4] 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=20251125062603.2614867-7-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