Skip to contentSkip to conversation

gpt: fix error reporting on partition table write failures

PATCH In review Rob Herring 3 participants 3 messages Jan 26, 2015 – Mar 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpt: fix error reporting on partition table write failures

The gpt command always reports success even if writing the partition table failed. Propagate the return value of gpt_restore so we get proper status reported.

---
 common/cmd_gpt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/cmd_gpt.c +2 -2
index e38422d..75df3fe 100644
@@ -281,11 +281,11 @@ static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
 	}
 
 	/* save partitions layout to disk */
-	gpt_restore(blk_dev_desc, str_disk_guid, partitions, part_count);
+	ret = gpt_restore(blk_dev_desc, str_disk_guid, partitions, part_count);
 	free(str_disk_guid);
 	free(partitions);
 
-	return 0;
+	return ret;
 }
 
 /**
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 gpt: fix error reporting on partition table write failures

Hello Rob,

Quoted 18 lines · Rob Herring

The gpt command always reports success even if writing the partition table failed. Propagate the return value of gpt_restore so we get proper status reported.

---
  common/cmd_gpt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
common/cmd_gpt.c +0 -0
index e38422d..75df3fe 100644
@@ -281,11 +281,11 @@ static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part)
  	}
 
  	/* save partitions layout to disk */

common/cmd_gpt.c static int gpt_default(block_dev_desc_t *blk_dev_desc, const char *str_part) · line 291

Quoted 10 lines
common/cmd_gpt.c +2 -2
-	gpt_restore(blk_dev_desc, str_disk_guid, partitions, part_count);
+	ret = gpt_restore(blk_dev_desc, str_disk_guid, partitions, part_count);
  	free(str_disk_guid);
  	free(partitions);
 
-	return 0;
+	return ret;
  }
 
  /**

This one commit, is ok.

Best regards,

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#2 lore raw
In reply to Rob Herring
Quoted 6 lines · Rob Herring

The gpt command always reports success even if writing the partition table failed. Propagate the return value of gpt_restore so we get proper status reported.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150306/3d360a16/attachment.sig>