diff mbox series

[RESEND,02/10] env: ext4: set gd->env_valid

Message ID 20200212184501.5911-3-patrick.delaunay@st.com
State Superseded
Headers show
Series env: ext4: add test for env in ext4 | expand

Commit Message

Patrick Delaunay Feb. 12, 2020, 6:44 p.m. UTC
Add a missing initialization of gd->env_valid in env_ext4_load
as it is already done in some other env device.

Set gd->env_valid = ENV_VALID in env_ext4_save() and env_ext4_load().

This patch allows to have a correct information in 'env info' command.

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---

 env/ext4.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/env/ext4.c b/env/ext4.c
index 1f6b1b5bd8..e3bbf4a4e0 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -31,6 +31,8 @@ 
 #include <ext4fs.h>
 #include <mmc.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 __weak const char *env_ext4_get_intf(void)
 {
 	return (const char *)CONFIG_ENV_EXT4_INTERFACE;
@@ -79,6 +81,7 @@  static int env_ext4_save(void)
 			CONFIG_ENV_EXT4_FILE, ifname, dev, part);
 		return 1;
 	}
+	gd->env_valid = ENV_VALID;
 
 	puts("done\n");
 	return 0;
@@ -125,7 +128,11 @@  static int env_ext4_load(void)
 		goto err_env_relocate;
 	}
 
-	return env_import(buf, 1);
+	err = env_import(buf, 1);
+	if (!err)
+		gd->env_valid = ENV_VALID;
+
+	return err;
 
 err_env_relocate:
 	env_set_default(NULL, 0);