The lmb_add_region_flags() first checks if the new region to be added
can be coalesced with existing regions. The check stops if the two
regions are adjecent but their flags do not match. However, it is
possible that the newly added region might be adjacent with the next
existing region and with matching flags. Check for this possibility by
not breaking out of the loop.

Signed-off-by: Sughosh Ganu <[email protected]>
---
 lib/lmb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index a5216bdccc7..a55bfe289db 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -204,14 +204,14 @@ static long lmb_add_region_flags(struct alist 
*lmb_rgn_lst, phys_addr_t base,
                ret = lmb_addrs_adjacent(base, size, rgnbase, rgnsize);
                if (ret > 0) {
                        if (flags != rgnflags)
-                               break;
+                               continue;
                        rgn[i].base -= size;
                        rgn[i].size += size;
                        coalesced++;
                        break;
                } else if (ret < 0) {
                        if (flags != rgnflags)
-                               break;
+                               continue;
                        rgn[i].size += size;
                        coalesced++;
                        break;
-- 
2.34.1

Reply via email to