Message ID | 20180730161927.14763-2-semen.protsenko@linaro.org |
---|---|
State | Accepted |
Commit | 13bbfb4a395d1c0811cd8624cda64ad2ad4746bf |
Headers | show |
Series | env: Make environment loading log more clear | expand |
On Mon, Jul 30, 2018 at 07:19:26PM +0300, Sam Protsenko wrote: > "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> Applied to u-boot/master, thanks! -- Tom
diff --git a/env/env.c b/env/env.c index 5c0842ac07..dc2999625b 100644 --- a/env/env.c +++ b/env/env.c @@ -195,14 +195,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; + } } return -ENODEV;
"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> --- 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) Changes in v3: - Print "Failed" message using debug() rather than removing it env/env.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)