Skip to contentSkip to conversation

boot/fit: print error name in boot_get_fdt_fit()

PATCH In review David Lechner 2 participants 2 messages Jan 29 – Feb 2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 boot/fit: print error name in boot_get_fdt_fit()

Print the actual error code in a couple of places in boot_get_fdt_fit().

These are FDT error codes, not errno, so printing the string is more helpful than printing the numeric value.

The only caller of boot_get_fdt_fit() unconditionally replaces the returned error code (fdt_noffset) with ENOENT so the actual error would otherwise be lost.

---
This change helped me find that we are affected by the recent change to strict dtb 8-byte alignment checking, so I expect it will help others as well.

---
 boot/image-fit.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
boot/image-fit.c +4 -2
index 85026c2d1d0..3ed69b5f7bc 100644
@@ -2501,7 +2501,8 @@ int boot_get_fdt_fit(struct bootm_headers *images, ulong addr,
 
 		err = fdt_open_into(ov, ovcopy, ovcopylen);
 		if (err < 0) {
-			printf("failed on fdt_open_into for DTO\n");
+			printf("failed on fdt_open_into for DTO: %s\n",
+			       fdt_strerror(err));
 			fdt_noffset = err;
 			goto out;
 		}
@@ -2509,7 +2510,8 @@ int boot_get_fdt_fit(struct bootm_headers *images, ulong addr,
 		base = map_sysmem(load, len + ovlen);
 		err = fdt_open_into(base, base, len + ovlen);
 		if (err < 0) {
-			printf("failed on fdt_open_into\n");
+			printf("failed on fdt_open_into: %s\n",
+			       fdt_strerror(err));
 			fdt_noffset = err;
 			goto out;
 		}

---
base-commit: eed514b11d04a2f8a949521ad3bffba3ec98bd2f
change-id: 20260129-boot-image-fit-print-error-code-6cb0a1a8694c

Best regards,

Signature · 1 line
David Lechner <[email protected]>
#1 lore raw
Quoted 10 lines · David Lechner

Print the actual error code in a couple of places in boot_get_fdt_fit().

These are FDT error codes, not errno, so printing the string is more helpful than printing the numeric value.

The only caller of boot_get_fdt_fit() unconditionally replaces the returned error code (fdt_noffset) with ENOENT so the actual error would otherwise be lost.

[...]

Applied to u-boot/master, thanks!

[1/1] boot/fit: print error name in boot_get_fdt_fit()

      commit: 8bca63d2ed9d73ec2ff83fa76510245e48e29730
Signature · 1 line
Tom