On 18/10/2024 15:51, Caleb Connolly via groups.io wrote:
lmb_add_region() returns a positive integer if the added regions causes
existing regions to be coalesced. We still want to notify the EFI
subsystem about these added regions though, so adjust lmb_add() to only
bail on errors.

This fixes EFI memory allocation on boards with adjacent memory banks as is the
case on several Qualcomm boards like the RB3 Gen 2.

Fixes: 2f6191526a13 (lmb: notify of any changes to the LMB memory map)
Signed-off-by: Caleb Connolly <caleb.conno...@linaro.org>
---
Cc: u-boot-q...@groups.io
---
  lib/lmb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index 78fe2d4de7c6..7e90f178763b 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -486,9 +486,9 @@ long lmb_add(phys_addr_t base, phys_size_t size)
        long ret;
        struct alist *lmb_rgn_lst = &lmb.free_mem;
ret = lmb_add_region(lmb_rgn_lst, base, size);
-       if (ret)
+       if (ret < 0)
                return ret;
if (lmb_should_notify(LMB_NONE))
                return lmb_map_update_notify(base, size, MAP_OP_ADD);

Tested-by: Neil Armstrong <neil.armstr...@linaro.org>

Thanks !
Neil

Reply via email to