[U-Boot] [PATCH v4 10/16] cmd: gpt: add print_gpt_info_err

Patrick Delaunay patrick.delaunay at st.com
Wed Mar 15 14:11:41 UTC 2017


Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello at st.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 cmd/gpt.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 7dfa44c..4d6ae8b 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -333,6 +333,16 @@ err:
 	return errno;
 }
 
+static void print_gpt_info_err(int ret)
+{
+	if (ret == -ENOENT)
+		printf("No partition list provided\n");
+	if (ret == -EBADF)
+		printf("Missing disk guid\n");
+	if ((ret == -EFAULT) || (ret == -EINVAL))
+		printf("Partition list incomplete\n");
+}
+
 static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part)
 {
 	int ret;
@@ -344,12 +354,7 @@ static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part)
 	ret = set_gpt_info(blk_dev_desc->lba, blk_dev_desc->blksz, str_part,
 			&str_disk_guid, &partitions, &part_count);
 	if (ret) {
-		if (ret == -ENOENT)
-			printf("No partition list provided\n");
-		if (ret == -EBADF)
-			printf("Missing disk guid\n");
-		if ((ret == -EFAULT) || (ret == -EINVAL))
-			printf("Partition list incomplete\n");
+		print_gpt_info_err(ret);
 		return -1;
 	}
 
@@ -375,16 +380,12 @@ static int gpt_verify(struct blk_desc *blk_dev_desc, const char *str_part)
 	ret = set_gpt_info(blk_dev_desc->lba, blk_dev_desc->blksz, str_part,
 			&str_disk_guid, &partitions, &part_count);
 	if (ret) {
+		print_gpt_info_err(ret);
 		if (ret == -ENOENT) {
-			printf("No partition list provided - only basic check\n");
 			ret = gpt_verify_headers(blk_dev_desc, gpt_head,
 						 &gpt_pte);
 			goto out;
 		}
-		if (ret == -EBADF)
-			printf("Missing disk guid\n");
-		if ((ret == -EFAULT) || (ret == -EINVAL))
-			printf("Partition list incomplete\n");
 		return -1;
 	}
 
-- 
1.9.1



More information about the U-Boot mailing list