From patchwork Mon Oct 8 18:14:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,V2,1/9] disk: part_efi: remove indent level from loop X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 190075 X-Patchwork-Delegate: trini@ti.com Message-Id: <1349720080-13119-1-git-send-email-swarren@wwwdotorg.org> To: Tom Rini Cc: u-boot@lists.denx.de, Stephen Warren , Rob Herring Date: Mon, 8 Oct 2012 12:14:32 -0600 From: Stephen Warren List-Id: U-Boot discussion From: Stephen Warren 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 --- 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 */