[PATCH] lib: sbi: Fix sbi_domain_root_add_memregion() for merging memregions

Anup Patel anup.patel at wdc.com
Thu Apr 22 12:48:58 BST 2021


We should decrement root_memregs_count by one after merging two
memregions otherwise new memregion added after a merge will be
appended after last sentinel memregion of zero order.

Signed-off-by: Anup Patel <anup.patel at wdc.com>
---
 lib/sbi/sbi_domain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c
index 69a3795..1b2e6e3 100644
--- a/lib/sbi/sbi_domain.c
+++ b/lib/sbi/sbi_domain.c
@@ -521,6 +521,7 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg)
 					nreg1++;
 				}
 				reg_merged = true;
+				root_memregs_count--;
 			}
 		}
 	} while (reg_merged);
-- 
2.25.1




More information about the opensbi mailing list