Skip to contentSkip to conversation

env: Make environment loading log more clear

PATCH Superseded Sam Protsenko 2 participants 5 messages Jul 20, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover env: Make environment loading log more clear

This patch series intended to make boot log better. Basically here we just remove unwanted error messages, relying on the message from most deep API to be printed (like mmc subsystem). At the moment this looks like most clean solution to cluttered log problem, as any other solution will be hackish.

With this patch set applied we will see something like this:

Loading Environment from FAT... MMC: no card present Loading Environment from MMC... OK

instead of:

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

Sam Protsenko (2):
env: Don't print "Failed" error message
disk: part: Remove redundant error message

 disk/part.c | 2 +-
 env/env.c   | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/2 env: Don't print "Failed" error message

"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.

---
 env/env.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
env/env.c +1 -3
index 5c0842ac07..3ab4ec4237 100644
@@ -196,9 +196,7 @@ int env_load(void)
 
 		printf("Loading Environment from %s... ", drv->name);
 		ret = drv->load();
-		if (ret)
-			printf("Failed (%d)\n", ret);
-		else
+		if (!ret)
 			printf("OK\n");
 
 		if (!ret)
Signature · 1 line
2.18.0
#2 lore raw

PATCH 1/2 env: Don't print "Failed" error message

Dear Sam,

env/env.c int env_load(void) · line 202

Quoted 5 lines · In message <[email protected]> you wrote:
env/env.c +1 -0
+		if (!ret)
 			printf("OK\n");
 
 		if (!ret)

Now we have two "if (!ret)" in sequence. Make this one block, please.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Commitment, n.:      Commitment can be illustrated by a breakfast
of ham and eggs. The chicken was involved, the pig was committed.
#3 lore raw

PATCH 1/2 env: Don't print "Failed" error message

Quoted 4 lines · Wolfgang Denk

Dear Sam,

Quoted 1 line · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 4 lines

+ if (!ret)

                      printf("OK\n");

              if (!ret)

Now we have two "if (!ret)" in sequence. Make this one block, please.

Good point. Will do in v2, thanks.

Quoted 10 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Commitment, n.: Commitment can be illustrated by a breakfast
of ham and eggs. The chicken was involved, the pig was committed.

#4 lore raw

PATCH 2/2 disk: part: Don't show redundant error message

In reply to Sam Protsenko

Underlying API should already print some meaningful error message, so this one is just brings more noise. E.g. we can see log like this:

MMC: no card present
** Bad device mmc 0 **

Obviously, second error message is unwanted. Let's only print it in case when DEBUG is defined to keep log short and clear.

---
 disk/part.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
disk/part.c +1 -1
index 9266a09ec3..9e457a6e72 100644
@@ -400,7 +400,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
 
 	*dev_desc = get_dev_hwpart(ifname, dev, hwpart);
 	if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
-		printf("** Bad device %s %s **\n", ifname, dev_hwpart_str);
+		debug("** Bad device %s %s **\n", ifname, dev_hwpart_str);
 		dev = -ENOENT;
 		goto cleanup;
 	}
Signature · 1 line
2.18.0