env: add failing trace in env_save

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>
This commit is contained in:
Patrick Delaunay 2020-06-24 10:17:50 +02:00 committed by Tom Rini
parent d5a6a5a927
commit 8968288cb4

16
env/env.c vendored
View File

@ -240,13 +240,17 @@ int env_save(void)
if (drv) { if (drv) {
int ret; int ret;
if (!drv->save)
return -ENODEV;
if (!env_has_inited(drv->location))
return -ENODEV;
printf("Saving Environment to %s... ", drv->name); printf("Saving Environment to %s... ", drv->name);
if (!drv->save) {
printf("not possible\n");
return -ENODEV;
}
if (!env_has_inited(drv->location)) {
printf("not initialized\n");
return -ENODEV;
}
ret = drv->save(); ret = drv->save();
if (ret) if (ret)
printf("Failed (%d)\n", ret); printf("Failed (%d)\n", ret);