Skip to contentSkip to conversation

hwconfig: Allow to use restricted env

PATCH In review Pali Rohár 2 participants 2 messages Aug 7, 2022 – Aug 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwconfig: Allow to use restricted env

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.

---
 common/hwconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/hwconfig.c +1 -1
index 43566b81bd48..cac0b6348f46 100644
@@ -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;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 6 lines · Pali Rohár

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.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom