From: Alexander Kabaev Date: Wed, 10 Jan 2018 20:42:33 +0000 Subject: [U-Boot] [PATCH] Relax check for valid environment in __hwconfig Message-ID: <20180110204233.77975-1-kan@FreeBSD.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 #include +#include #include #include #include @@ -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