[v3,05/15] env: Make it explicit where we're loading our environment from

Message ID b4e40f0c190fe859492c3228fd7aea0f58ef7c61.1516723179.git-series.maxime.ripard@free-electrons.com
State Accepted
Commit 3574ba019ed626ffa4581ed0a4b0d628ebc048b4
Headers show
Series
  • env: Multiple env support and env transition for sunxi
Related show

Commit Message

Maxime Ripard Jan. 23, 2018, 8:16 p.m.
Since we can have multiple environments now, it's better to provide a
decent indication on what environments were tried and which were the one to
fail and succeed.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 env/env.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Comments

Tom Rini Jan. 27, 2018, 7:20 p.m. | #1
On Tue, Jan 23, 2018 at 09:16:54PM +0100, Maxime Ripard wrote:

> Since we can have multiple environments now, it's better to provide a

> decent indication on what environments were tried and which were the one to

> fail and succeed.

> 

> Reviewed-by: Simon Glass <sjg@chromium.org>

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>


Applied to u-boot/master, thanks!

-- 
Tom

Patch

diff --git a/env/env.c b/env/env.c
index 11667a3cbc71..906f28ee50a1 100644
--- a/env/env.c
+++ b/env/env.c
@@ -144,12 +144,15 @@  int env_load(void)
 		if (!drv->load)
 			continue;
 
+		printf("Loading Environment from %s... ", drv->name);
 		ret = drv->load();
+		if (ret)
+			printf("Failed (%d)\n", ret);
+		else
+			printf("OK\n");
+
 		if (!ret)
 			return 0;
-
-		debug("%s: Environment %s failed to load (err=%d)\n", __func__,
-		      drv->name, ret);
 	}
 
 	return -ENODEV;
@@ -168,12 +171,13 @@  int env_save(void)
 
 		printf("Saving Environment to %s... ", drv->name);
 		ret = drv->save();
-		printf("%s\n", ret ? "Failed" : "OK");
+		if (ret)
+			printf("Failed (%d)\n", ret);
+		else
+			printf("OK\n");
+
 		if (!ret)
 			return 0;
-
-		debug("%s: Environment %s failed to save (err=%d)\n", __func__,
-		      drv->name, ret);
 	}
 
 	return -ENODEV;