diff mbox

[U-Boot,V2,1/9] disk: part_efi: remove indent level from loop

Message ID 1349720080-13119-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren Oct. 8, 2012, 6:14 p.m. UTC
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(-)

Comments

Tom Rini Oct. 17, 2012, 3:01 p.m. UTC | #1
On Mon, Oct 08, 2012 at 08:14:32AM -0000, Stephen Warren wrote:

> 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>

This, along with the rest of the series have been applied to
u-boot/master, thanks!  Note that for 9/9 I had to rework it slightly to
take the new output formatting, can you please double check?  Thanks!
Stephen Warren Oct. 17, 2012, 4:04 p.m. UTC | #2
On 10/17/2012 09:01 AM, Tom Rini wrote:
> On Mon, Oct 08, 2012 at 08:14:32AM -0000, Stephen Warren wrote:
> 
>> 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>
> 
> This, along with the rest of the series have been applied to 
> u-boot/master, thanks!  Note that for 9/9 I had to rework it
> slightly to take the new output formatting, can you please double
> check?  Thanks!

Thanks. The results looks fine; there is zero diff between my local
branch and u-boot/master on the files that series touched.

I wonder if the rework you needed to do was because patch 8/9 wasn't
applied? I did do some cleanup of the printf strings in that patch
separately, but there isn't an equivalent commit in your tree; it's as
if 8/9 and 9/9 were squashed into one.

BTW, I had also posted a minor fix "disk: initialize name/part fields
when returning a whole disk" which may have been overlooked? Perhaps
it's still in your queue.

Thanks.
Tom Rini Oct. 17, 2012, 4:12 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/17/12 09:04, Stephen Warren wrote:
> On 10/17/2012 09:01 AM, Tom Rini wrote:
>> On Mon, Oct 08, 2012 at 08:14:32AM -0000, Stephen Warren wrote:
>> 
>>> 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>
>> 
>> This, along with the rest of the series have been applied to 
>> u-boot/master, thanks!  Note that for 9/9 I had to rework it 
>> slightly to take the new output formatting, can you please
>> double check?  Thanks!
> 
> Thanks. The results looks fine; there is zero diff between my
> local branch and u-boot/master on the files that series touched.
> 
> I wonder if the rework you needed to do was because patch 8/9
> wasn't applied? I did do some cleanup of the printf strings in that
> patch separately, but there isn't an equivalent commit in your
> tree; it's as if 8/9 and 9/9 were squashed into one.

There we go, I just missed 8/9 (I see it in my patchwork TODO list now).

> BTW, I had also posted a minor fix "disk: initialize name/part
> fields when returning a whole disk" which may have been overlooked?
> Perhaps it's still in your queue.

That is still in my queue.  I'm trying to leave a buffer around when
patches are posted vs when I pull them in to allow for more review by
the folks doing U-Boot in their spare time.  I should pick up that as
well as the fat_set_blk_dev series soon.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQftkCAAoJENk4IS6UOR1WQ/0QAJYx2bZV00XlnlaTqJCI3OqO
jiYuf30LI2isnzQz+eaxom844s0nHexnviNKio9HBtDaD6FAgL2CyH6TKPB5Lh0C
kl4LgagcxX2Vs+ZpMElr07xcdiUFuRo/y527pCndikG43wYUtVZ+Piubuh1ASVDa
W6ex4B3MAMCLAdFIfz0UhJHVCvaXMioC8i4lPCx/3cAWIISQmITg7B5/hVMYzR06
6/yu4hxn2wOw7hTEVN7UO05N4kcKmehtzA09Kr/UxedbtrcfyAYCVzzIc2ynryAd
8Y7t674+omkcV8/ZN04qBsFqfT79pQK33r5Hb9qeHrW0tpDZKCHqN6VKpM1CvlDI
TX1ni2LQ7T6FM0fkENLy3dpVDYQfEHk9Zln6+ttIHz3nbsHArUDoM8rV8Lq9PTjk
766NfTcxPfm6mGFhGLRwbhZZTTLl/YrigFx+M6ECnpBFsdp9oKe6KfCphSEwh2xC
aREBUr6+TIZZ8ynXIg5ahy4JMEe8x1z+qvs08AQC4oAFvNMi+zPPf6aGU7lCuz9p
SpiJSFMDIznZZz6Q+/aZy18l03T9cbxV6mEffBEyGNOg/yiBcoymrdxVoKnFlbs/
vU5aF7a0mXZ1E9zsLbpvwcomdUwmYsrqpz7nLiS/lG4qdA5AQp4/xSGuLYynjoho
HjoUE934eU4EaYKJRjhv
=k4ym
-----END PGP SIGNATURE-----
Stephen Warren Oct. 17, 2012, 4:25 p.m. UTC | #4
On 10/17/2012 10:12 AM, Tom Rini wrote:
> On 10/17/12 09:04, Stephen Warren wrote:
...
>> BTW, I had also posted a minor fix "disk: initialize name/part
>> fields when returning a whole disk" which may have been overlooked?
>> Perhaps it's still in your queue.
> 
> That is still in my queue.  I'm trying to leave a buffer around when
> patches are posted vs when I pull them in to allow for more review by
> the folks doing U-Boot in their spare time.

OK, makes sense.

> I should pick up that as well as the fat_set_blk_dev series soon.

Pavel had some comments on that series; I might rework it to drop the
first two patches and replace them with something that simply removes
the partition number from the printf. Feel free to weigh in on that
thread if you have an opinion which way to go.
diff mbox

Patch

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 */