env: Don't show "Failed" error message
authorSam Protsenko <semen.protsenko@linaro.org>
Mon, 30 Jul 2018 16:19:26 +0000 (19:19 +0300)
committerTom Rini <trini@konsulko.com>
Fri, 10 Aug 2018 17:45:34 +0000 (13:45 -0400)
"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)

Let's only print it in case when DEBUG is defined to keep log clear.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
env/env.c

index e033b46..afed0f3 100644 (file)
--- a/env/env.c
+++ b/env/env.c
@@ -186,14 +186,18 @@ 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) {
+                       debug("Failed (%d)\n", ret);
+               } else {
                        printf("OK\n");
-
-               if (!ret)
                        return 0;
+               }
        }
 
        /*