Skip to contentSkip to conversation

mmc: show error message when "mmc dev" command fails

PATCH New Masahiro Yamada 3 participants 4 messages Feb 10, 2016 – Feb 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: show error message when "mmc dev" command fails

Currently, "mmc dev" can silently fail. In case of failure, tell the user about it.

---

 cmd/mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
cmd/mmc.c +3 -1
index 1c7156f..87a9fb6 100644
@@ -463,8 +463,10 @@ static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
 	}
 
 	mmc = init_mmc_device(dev, true);
-	if (!mmc)
+	if (!mmc) {
+		printf("could not switch to mmc%d\n", dev);
 		return CMD_RET_FAILURE;
+	}
 
 	ret = mmc_select_hwpart(dev, part);
 	printf("switch to partitions #%d, %s\n",
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 mmc: show error message when "mmc dev" command fails

Quoted 16 lines · Masahiro Yamada

Currently, "mmc dev" can silently fail. In case of failure, tell the user about it.

---

  cmd/mmc.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
cmd/mmc.c +0 -0
index 1c7156f..87a9fb6 100644
@@ -463,8 +463,10 @@ static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
  	}

cmd/mmc.c static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag, · line 472

Quoted 10 lines
cmd/mmc.c +3 -1
 
  	mmc = init_mmc_device(dev, true);
-	if (!mmc)
+	if (!mmc) {
+		printf("could not switch to mmc%d\n", dev);
  		return CMD_RET_FAILURE;
+	}
 
  	ret = mmc_select_hwpart(dev, part);
  	printf("switch to partitions #%d, %s\n",

Thanks,
Stefan

#2 lore raw

PATCH 1/1 mmc: show error message when "mmc dev" command fails

In reply to Masahiro Yamada
Quoted 2 lines · Masahiro Yamada

Currently, "mmc dev" can silently fail. In case of failure, tell the user about it.

Does it make sense to print this error inside init_mmc_device() instead, so that we don't have to add printf()s to all call sites?

I'm not sure the answer to my question is yes; just something to ponder.

Also note that one disadvantage of printing error messages all the time is that the distro boot scripts (by default) attempt to probe all defined storage devices, so printing errors will make that noisy. Perhaps that should be solved by adding a -q option (for "quiet") so those scripts can be non-noisy?

#3 lore raw

PATCH 1/1 mmc: show error message when "mmc dev" command fails

2016-02-11 1:27 GMT+09:00 Stephen Warren <[email protected]>:

Quoted 10 lines · Masahiro Yamada
Quoted 3 lines

Currently, "mmc dev" can silently fail. In case of failure, tell the user about it.

Does it make sense to print this error inside init_mmc_device() instead, so that we don't have to add printf()s to all call sites?

I'm not sure the answer to my question is yes; just something to ponder.

I guess it makes sense.
(I have not taken a close look, though)

Quoted 5 lines

Also note that one disadvantage of printing error messages all the time is that the distro boot scripts (by default) attempt to probe all defined storage devices, so printing errors will make that noisy. Perhaps that should be solved by adding a -q option (for "quiet") so those scripts can be non-noisy?

Sounds reasonable, too.

Signature · 2 lines
Best Regards
Masahiro Yamada