env: add failing trace in env_save
authorPatrick Delaunay <patrick.delaunay@st.com>
Wed, 24 Jun 2020 08:17:50 +0000 (10:17 +0200)
committerTom Rini <trini@konsulko.com>
Sun, 26 Jul 2020 18:35:30 +0000 (14:35 -0400)
Add trace in env save to indicate any errors to end user and avoid
silent output when the command 'env save' is not executed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
env/env.c

index 49545a8..2e64346 100644 (file)
--- a/env/env.c
+++ b/env/env.c
@@ -240,13 +240,17 @@ int env_save(void)
        if (drv) {
                int ret;
 
-               if (!drv->save)
+               printf("Saving Environment to %s... ", drv->name);
+               if (!drv->save) {
+                       printf("not possible\n");
                        return -ENODEV;
+               }
 
-               if (!env_has_inited(drv->location))
+               if (!env_has_inited(drv->location)) {
+                       printf("not initialized\n");
                        return -ENODEV;
+               }
 
-               printf("Saving Environment to %s... ", drv->name);
                ret = drv->save();
                if (ret)
                        printf("Failed (%d)\n", ret);