Skip to content

Commit cd9b3a6

Browse files
committed
elfloader: avoid redundant calculation
Signed-off-by: Axel Heider <axelheider@gmx.de>
1 parent fd0a5ec commit cd9b3a6

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

elfloader-tool/src/common.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,9 @@ int load_images(
430430
return -1;
431431
}
432432

433+
/* Reserve space for the kernel, keep next start address page aligned. */
434+
next_phys_addr = ROUND_UP(kernel_phys_end, PAGE_BITS);
435+
433436
void const *dtb = NULL;
434437

435438
#ifdef CONFIG_ELFLOADER_INCLUDE_DTB
@@ -465,9 +468,7 @@ int load_images(
465468
* Move the DTB out of the way, if it's present.
466469
*/
467470
if (dtb) {
468-
/* keep it page aligned */
469-
next_phys_addr = dtb_phys_start = ROUND_UP(kernel_phys_end, PAGE_BITS);
470-
471+
dtb_phys_start = next_phys_addr;
471472
size_t dtb_size = fdt_size(dtb);
472473
if (0 == dtb_size) {
473474
printf("ERROR: Invalid device tree blob supplied\n");
@@ -491,8 +492,6 @@ int load_images(
491492
printf(" paddr=[%p..%p]\n", dtb_phys_start, dtb_phys_end - 1);
492493
*chosen_dtb = (void *)dtb_phys_start;
493494
*chosen_dtb_size = dtb_size;
494-
} else {
495-
next_phys_addr = ROUND_UP(kernel_phys_end, PAGE_BITS);
496495
}
497496

498497
/* Load the kernel */

0 commit comments

Comments
 (0)