[PATCH v2] cmd: gpt: remove redundant print messages

Ravik Hasija rahasij at linux.microsoft.com
Wed Mar 31 20:15:49 CEST 2021


Removing printfs from do_gpt API as the messages are generic and does not
specify error codes for failure cases.

Signed-off-by: Ravik Hasija <rahasij at linux.microsoft.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay at st.com>
---
Changes for v2:
  - Updated usage message for gpt read
  - Added removed printfs for write & verify
  - Rearranged verify printf
---
 cmd/gpt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 76a95ade6c..ba0fa4c69c 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -971,9 +971,11 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	if ((strcmp(argv[1], "write") == 0) && (argc == 5)) {
 		printf("Writing GPT: ");
 		ret = gpt_default(blk_dev_desc, argv[4]);
+		ret ? printf("error!\n") : printf("success!\n");
 	} else if ((strcmp(argv[1], "verify") == 0)) {
-		ret = gpt_verify(blk_dev_desc, argv[4]);
 		printf("Verify GPT: ");
+		ret = gpt_verify(blk_dev_desc, argv[4]);
+		ret ? printf("error!\n") : printf("success!\n");
 	} else if ((strcmp(argv[1], "setenv") == 0)) {
 		ret = gpt_setenv(blk_dev_desc, argv[4]);
 	} else if ((strcmp(argv[1], "enumerate") == 0)) {
@@ -992,11 +994,9 @@ static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	}
 
 	if (ret) {
-		printf("error!\n");
 		return CMD_RET_FAILURE;
 	}
 
-	printf("success!\n");
 	return CMD_RET_SUCCESS;
 }
 
@@ -1017,7 +1017,7 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt,
 	"      gpt_partition_name, gpt_partition_entry\n"
 	" gpt enumerate mmc 0\n"
 	"    - store list of partitions to gpt_partition_list environment variable\n"
-	" read <interface> <dev>\n"
+	" gpt read <interface> <dev>\n"
 	"    - read GPT into a data structure for manipulation\n"
 	" gpt guid <interface> <dev>\n"
 	"    - print disk GUID\n"
-- 
2.17.1



More information about the U-Boot mailing list