public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2 1/9] disk: part_efi: remove indent level from loop
@ 2012-10-08 18:14 Stephen Warren
  2012-10-08 18:14 ` [U-Boot] [PATCH V2 2/9] disk: part_efi: re-order partition list printf, change case Stephen Warren
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Stephen Warren @ 2012-10-08 18:14 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

Simplify the partition printing loop in print_part_efi() to bail out
early when the first invalid partition is found, rather than indenting
the whole body of the loop. This simplifies later patches.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2: Rebased series on top of the bug-fixes I sent for the release.

 disk/part_efi.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 264ea9c..008177e 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -138,15 +138,14 @@ void print_part_efi(block_dev_desc_t * dev_desc)
 
 	printf("Part\tName\t\t\tStart LBA\tEnd LBA\n");
 	for (i = 0; i < le32_to_int(gpt_head->num_partition_entries); i++) {
+		/* Stop at the first non valid PTE */
+		if (!is_pte_valid(&gpt_pte[i]))
+			break;
 
-		if (is_pte_valid(&gpt_pte[i])) {
-			printf("%3d\t%-18s\t0x%08llX\t0x%08llX\n", (i + 1),
-				print_efiname(&gpt_pte[i]),
-				le64_to_int(gpt_pte[i].starting_lba),
-				le64_to_int(gpt_pte[i].ending_lba));
-		} else {
-			break;	/* Stop at the first non valid PTE */
-		}
+		printf("%3d\t%-18s\t0x%08llX\t0x%08llX\n", (i + 1),
+			print_efiname(&gpt_pte[i]),
+			le64_to_int(gpt_pte[i].starting_lba),
+			le64_to_int(gpt_pte[i].ending_lba));
 	}
 
 	/* Remember to free pte */
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-10-17 16:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08 18:14 [U-Boot] [PATCH V2 1/9] disk: part_efi: remove indent level from loop Stephen Warren
2012-10-08 18:14 ` [U-Boot] [PATCH V2 2/9] disk: part_efi: re-order partition list printf, change case Stephen Warren
2012-10-08 18:14 ` [U-Boot] [PATCH V2 3/9] disk: part_efi: print partition UUIDs Stephen Warren
2012-10-08 18:14 ` [U-Boot] [PATCH V2 4/9] disk: part_efi: add new partition attribute definitions Stephen Warren
2012-10-08 18:14 ` [U-Boot] [PATCH V2 5/9] disk: part_efi: print raw partition attributes Stephen Warren
2012-10-08 18:14 ` [U-Boot] [PATCH V2 6/9] disk: part_efi: set bootable flag in partition objects Stephen Warren
2012-10-08 18:14 ` [U-Boot] [PATCH V2 7/9] disk: part_dos: checkpatch cleanups Stephen Warren
2012-10-08 18:14 ` [U-Boot] [PATCH V2 8/9] disk: part_dos: align partition table prints Stephen Warren
2012-10-08 18:14 ` [U-Boot] [PATCH V2 9/9] disk: part_dos: print partition UUID in partition list Stephen Warren
2012-10-17 15:01 ` [U-Boot] [U-Boot, V2, 1/9] disk: part_efi: remove indent level from loop Tom Rini
2012-10-17 16:04   ` Stephen Warren
2012-10-17 16:12     ` Tom Rini
2012-10-17 16:25       ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox