The function only needs env_get to be functional, so check
do env_valid flag instead. There is no reason why this function
should not work if environment is available early.
---
 common/hwconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/hwconfig.c b/common/hwconfig.c
index e5186d7796..d7aed7b31a 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -76,7 +76,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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to