diff --git a/payloads/libpayload/arch/arm64/mmu.c b/payloads/libpayload/arch/arm64/mmu.c index bb7954473c..5865b1b9ef 100644 --- a/payloads/libpayload/arch/arm64/mmu.c +++ b/payloads/libpayload/arch/arm64/mmu.c @@ -575,8 +575,6 @@ static struct mmu_memrange *_mmu_add_fb_range( prop.type = TYPE_DMA_MEM; - /* make sure to allocate a size of multiple of GRANULE_SIZE */ - size = ALIGN_UP(size, GRANULE_SIZE); prop.size = size; prop.lim_excl = MIN_64_BIT_ADDR; prop.align = MB_SIZE; @@ -634,6 +632,9 @@ static void mmu_add_fb_range(struct mmu_ranges *mmu_ranges) if (!fb_size) return; + /* make sure to allocate a size of multiple of GRANULE_SIZE */ + fb_size = ALIGN_UP(fb_size, GRANULE_SIZE); + /* framebuffer address has been set already, so just add it as DMA */ if (framebuffer->physical_address) { if (mmu_add_memrange(mmu_ranges,