diff mbox series

[v2,1/2] env: Don't print "Failed" error message

Message ID 20180720151856.23458-2-semen.protsenko@linaro.org
State Superseded
Headers show
Series env: Make environment loading log more clear | expand

Commit Message

Sam Protsenko July 20, 2018, 3:18 p.m. UTC
"Failed" error message from env_load() only clutters the log with
unnecessary details, as we already have all needed warnings by that
time. Example:

    Loading Environment from FAT... MMC: no card present
    ** Bad device mmc 0 **
    Failed (-5)

Remove this "Failed" message to keep log short and clear.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
Changes in v2:
  - Join two consecutive "if (!ret)" conditions
  - Add the comment with requirement for underlying API to print error
    message (as we don't print "Failed" message anymore)

 env/env.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/env/env.c b/env/env.c
index 5c0842ac07..c830001eee 100644
--- a/env/env.c
+++ b/env/env.c
@@ -195,14 +195,16 @@  int env_load(void)
 			continue;
 
 		printf("Loading Environment from %s... ", drv->name);
+		/*
+		 * In error case, the error message must be printed during
+		 * drv->load() in some underlying API, and it must be exactly
+		 * one message.
+		 */
 		ret = drv->load();
-		if (ret)
-			printf("Failed (%d)\n", ret);
-		else
+		if (!ret) {
 			printf("OK\n");
-
-		if (!ret)
 			return 0;
+		}
 	}
 
 	return -ENODEV;