All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Simon Glass <sjg@chromium.org>, Wolfgang Denk <wd@denx.de>
Cc: u-boot@lists.denx.de
Subject: [PATCH] hwconfig: Allow to use restricted env
Date: Sun,  7 Aug 2022 21:06:04 +0200	[thread overview]
Message-ID: <20220807190604.20318-1-pali@kernel.org> (raw)

During early boot phase GD_FLG_ENV_READY is not set but env_get() may work
when env is ready in restricted mode. Do not fail with error message
"WARNING: Calling __hwconfig without a buffer and before environment is ready"
when env is already working by checking for ENV_VALID flag.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 common/hwconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/hwconfig.c b/common/hwconfig.c
index 43566b81bd48..cac0b6348f46 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -78,7 +78,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
 
 	/* if we are passed a buffer use it, otherwise try the environment */
 	if (!env_hwconfig) {
-		if (!(gd->flags & GD_FLG_ENV_READY)) {
+		if (!(gd->flags & GD_FLG_ENV_READY) && gd->env_valid != ENV_VALID) {
 			printf("WARNING: Calling __hwconfig without a buffer "
 					"and before environment is ready\n");
 			return NULL;
-- 
2.20.1


             reply	other threads:[~2022-08-07 19:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 19:06 Pali Rohár [this message]
2022-08-20 23:02 ` [PATCH] hwconfig: Allow to use restricted env Tom Rini

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=20220807190604.20318-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.