Skip to contentSkip to conversation

boot/android_ab.c: Make use of LBAF for printing lbaint_t

PATCH In review Tom Rini 3 participants 7 messages Jul 2, 2025 – Jul 9, 2025

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 boot/android_ab.c: Make use of LBAF for printing lbaint_t

When printing the contents of an lbaint_t variable we need to use LBAF to print it in order to get the correct format type depending on 32 or 64bit-ness. Furthermore, printed message should not be split as that makes finding them harder, so bring this back to a single line.

---
Cc: Mattijs Korpershoek <[email protected]>
Cc: Igor Opaniuk <[email protected]>
Cc: Sam Protsenko <[email protected]>

---
 boot/android_ab.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
boot/android_ab.c +1 -2
index a287eac04fe8..13e82dbcb7fe 100644
@@ -101,8 +101,7 @@ static int ab_control_create_from_disk(struct blk_desc *dev_desc,
 	abc_blocks = DIV_ROUND_UP(sizeof(struct bootloader_control),
 				  part_info->blksz);
 	if (abc_offset + abc_blocks > part_info->size) {
-		log_err("ANDROID: boot control partition too small. Need at");
-		log_err(" least %lu blocks but have %lu blocks.\n",
+		log_err("ANDROID: boot control partition too small. Need at least %lu blocks but have " LBAF " blocks.\n",
 			abc_offset + abc_blocks, part_info->size);
 		return -EINVAL;
 	}
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 common/avb_verify.c: Make use of LBAF for printing lbaint_t

When printing the contents of an lbaint_t variable we need to use LBAF to print it in order to get the correct format type depending on 32 or 64bit-ness.

---
Cc: Mattijs Korpershoek <[email protected]>
Cc: Igor Opaniuk <[email protected]>
Cc: Sam Protsenko <[email protected]>

---
 common/avb_verify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/avb_verify.c +2 -2
index cff9117d92f1..29a3272579cf 100644
@@ -320,7 +320,7 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part,
 	}
 	if ((start + sectors) > (part->info.start + part->info.size)) {
 		sectors = part->info.start + part->info.size - start;
-		printf("%s: read sector aligned to partition bounds (%ld)\n",
+		printf("%s: read sector aligned to partition bounds (" LBAF ")\n",
 		       __func__, sectors);
 	}
 
@@ -363,7 +363,7 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start,
 	}
 	if ((start + sectors) > (part->info.start + part->info.size)) {
 		sectors = part->info.start + part->info.size - start;
-		printf("%s: sector aligned to partition bounds (%ld)\n",
+		printf("%s: sector aligned to partition bounds (" LBAF ")\n",
 		       __func__, sectors);
 	}
 	if (unaligned) {
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] common/avb_verify.c: Make use of LBAF for printing lbaint_t

Hi Tom,

Thank you for the patch.

Quoted 5 lines · Tom Rini

When printing the contents of an lbaint_t variable we need to use LBAF to print it in order to get the correct format type depending on 32 or 64bit-ness.

Quoted 32 lines

---
Cc: Mattijs Korpershoek <[email protected]>
Cc: Igor Opaniuk <[email protected]>
Cc: Sam Protsenko <[email protected]>

---
 common/avb_verify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/avb_verify.c +2 -2
index cff9117d92f1..29a3272579cf 100644
@@ -320,7 +320,7 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part,
 	}
 	if ((start + sectors) > (part->info.start + part->info.size)) {
 		sectors = part->info.start + part->info.size - start;
-		printf("%s: read sector aligned to partition bounds (%ld)\n",
+		printf("%s: read sector aligned to partition bounds (" LBAF ")\n",
 		       __func__, sectors);
 	}
 
@@ -363,7 +363,7 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start,
 	}
 	if ((start + sectors) > (part->info.start + part->info.size)) {
 		sectors = part->info.start + part->info.size - start;
-		printf("%s: sector aligned to partition bounds (%ld)\n",
+		printf("%s: sector aligned to partition bounds (" LBAF ")\n",
 		       __func__, sectors);
 	}
 	if (unaligned) {
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] common/avb_verify.c: Make use of LBAF for printing lbaint_t

In reply to Tom Rini
Quoted 11 lines · Tom Rini

When printing the contents of an lbaint_t variable we need to use LBAF to print it in order to get the correct format type depending on 32 or 64bit-ness.

---
Cc: Mattijs Korpershoek <[email protected]>
Cc: Igor Opaniuk <[email protected]>
Cc: Sam Protsenko <[email protected]>
---

Quoted 28 lines
 common/avb_verify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/avb_verify.c +2 -3
index cff9117d92f1..29a3272579cf 100644
@@ -320,7 +320,7 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part,
        }
        if ((start + sectors) > (part->info.start + part->info.size)) {
                sectors = part->info.start + part->info.size - start;
-               printf("%s: read sector aligned to partition bounds (%ld)\n",
+               printf("%s: read sector aligned to partition bounds (" LBAF ")\n",
                       __func__, sectors);
        }
 
@@ -363,7 +363,7 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start,
        }
        if ((start + sectors) > (part->info.start + part->info.size)) {
                sectors = part->info.start + part->info.size - start;
-               printf("%s: sector aligned to partition bounds (%ld)\n",
+               printf("%s: sector aligned to partition bounds (" LBAF ")\n",
                       __func__, sectors);
        }
        if (unaligned) {
--

2.43.0

Reviewed-by on v1 1/2
#4 lore raw
In reply to Tom Rini

Hi Tom,

Thank you for the patch.

Quoted 6 lines · Tom Rini

When printing the contents of an lbaint_t variable we need to use LBAF to print it in order to get the correct format type depending on 32 or 64bit-ness. Furthermore, printed message should not be split as that makes finding them harder, so bring this back to a single line.

Quoted 24 lines

---
Cc: Mattijs Korpershoek <[email protected]>
Cc: Igor Opaniuk <[email protected]>
Cc: Sam Protsenko <[email protected]>

---
 boot/android_ab.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
boot/android_ab.c +1 -2
index a287eac04fe8..13e82dbcb7fe 100644
@@ -101,8 +101,7 @@ static int ab_control_create_from_disk(struct blk_desc *dev_desc,
 	abc_blocks = DIV_ROUND_UP(sizeof(struct bootloader_control),
 				  part_info->blksz);
 	if (abc_offset + abc_blocks > part_info->size) {
-		log_err("ANDROID: boot control partition too small. Need at");
-		log_err(" least %lu blocks but have %lu blocks.\n",
+		log_err("ANDROID: boot control partition too small. Need at least %lu blocks but have " LBAF " blocks.\n",
 			abc_offset + abc_blocks, part_info->size);
 		return -EINVAL;
 	}
Signature · 1 line
2.43.0
Reviewed-by on v1 1/2
#5 lore raw
In reply to Tom Rini
Quoted 6 lines · Tom Rini

When printing the contents of an lbaint_t variable we need to use LBAF to print it in order to get the correct format type depending on 32 or 64bit-ness. Furthermore, printed message should not be split as that makes finding them harder, so bring this back to a single line.

Quoted 6 lines

---
Cc: Mattijs Korpershoek <[email protected]>
Cc: Igor Opaniuk <[email protected]>
Cc: Sam Protsenko <[email protected]>
---

Quoted 20 lines
 boot/android_ab.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
boot/android_ab.c +1 -3
index a287eac04fe8..13e82dbcb7fe 100644
@@ -101,8 +101,7 @@ static int ab_control_create_from_disk(struct blk_desc *dev_desc,
        abc_blocks = DIV_ROUND_UP(sizeof(struct bootloader_control),
                                  part_info->blksz);
        if (abc_offset + abc_blocks > part_info->size) {
-               log_err("ANDROID: boot control partition too small. Need at");
-               log_err(" least %lu blocks but have %lu blocks.\n",
+               log_err("ANDROID: boot control partition too small. Need at least %lu blocks but have " LBAF " blocks.\n",
                        abc_offset + abc_blocks, part_info->size);
                return -EINVAL;
        }
--

2.43.0

#6 lore raw
In reply to Tom Rini

Hi,

Quoted 6 lines · Tom Rini

When printing the contents of an lbaint_t variable we need to use LBAF to print it in order to get the correct format type depending on 32 or 64bit-ness. Furthermore, printed message should not be split as that makes finding them harder, so bring this back to a single line.

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)

[1/2] boot/android_ab.c: Make use of LBAF for printing lbaint_t

      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/ab0d5fe4cba420467689be9cbf4ddccabc54cfa8
[2/2] common/avb_verify.c: Make use of LBAF for printing lbaint_t
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/34272133d9e5a46fde6c7f87e452e4b5e51c2999

--
Mattijs