From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] state: don't report error for -ENOMEDIUM
Date: Mon, 20 Jun 2022 09:19:36 +0200 [thread overview]
Message-ID: <20220620071936.1460295-1-a.fatoum@pengutronix.de> (raw)
Since commit 863a2251393e ("state: make first boot less verbose"),
state_load returns -ENOMEDIUM instead of -ENOENT if we detect
a first load because all buckets are zero.
This case is expected and shouldn't warrant an error message, so
adjust callers appropriately.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
commands/state.c | 3 +++
common/efi/payload/init.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/commands/state.c b/commands/state.c
index e7cb9902f71a..56ef93b19fa4 100644
--- a/commands/state.c
+++ b/commands/state.c
@@ -53,6 +53,9 @@ static int do_state(int argc, char *argv[])
ret = state_save(state);
}
+ if (ret == -ENOMEDIUM)
+ ret = 0;
+
return ret;
}
diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
index e2bddabc9a42..6976285fb3c3 100644
--- a/common/efi/payload/init.c
+++ b/common/efi/payload/init.c
@@ -359,7 +359,7 @@ static int efi_late_init(void)
return PTR_ERR(state);
ret = state_load(state);
- if (ret)
+ if (ret != -ENOMEDIUM)
pr_warn("Failed to load persistent state, continuing with defaults, %d\n",
ret);
--
2.30.2
next reply other threads:[~2022-06-20 7:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 7:19 Ahmad Fatoum [this message]
2022-06-20 9:38 ` Sascha Hauer
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=20220620071936.1460295-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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