public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexander Kabaev <kan@FreeBSD.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Relax check for valid environment in __hwconfig
Date: Wed, 10 Jan 2018 20:42:33 +0000	[thread overview]
Message-ID: <20180110204233.77975-1-kan@FreeBSD.org> (raw)

The function only needs env_get to be functional, so check
the env_valid flag instead. There is no reason why this function
should not work if environment is available early, say by being
directly mapped in SPI.
---
 common/hwconfig.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/hwconfig.c b/common/hwconfig.c
index e5186d7796..4006aad59c 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -12,6 +12,7 @@
 #ifndef HWCONFIG_TEST
 #include <config.h>
 #include <common.h>
+#include <environment.h>
 #include <exports.h>
 #include <hwconfig.h>
 #include <linux/types.h>
@@ -76,7 +77,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->env_valid == ENV_INVALID) {
 			printf("WARNING: Calling __hwconfig without a buffer "
 					"and before environment is ready\n");
 			return NULL;
-- 
2.15.1

             reply	other threads:[~2018-01-10 20:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 20:42 Alexander Kabaev [this message]
2018-01-11 16:32 ` [U-Boot] [PATCH] Relax check for valid environment in __hwconfig 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=20180110204233.77975-1-kan@FreeBSD.org \
    --to=kan@freebsd.org \
    --cc=u-boot@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox