@@ -340,25 +340,27 @@ void __init fw_unreserved_regions(paddr_t s, paddr_t e,
bool __init check_reserved_regions_overlap(paddr_t region_start,
paddr_t region_size)
{
+ const struct membanks *mem_banks[] = {
+ bootinfo_get_reserved_mem(),
+#ifdef CONFIG_ACPI
+ bootinfo_get_acpi(),
+#endif
+ };
+ unsigned int i;
+
/*
- * Check if input region is overlapping with bootinfo_get_reserved_mem()
- * banks
+ * Check if input region is overlapping with reserved memory banks or
+ * ACPI EfiACPIReclaimMemory (when ACPI feature is enabled)
*/
- if ( meminfo_overlap_check(bootinfo_get_reserved_mem(),
- region_start, region_size) )
- return true;
+ for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
+ if ( meminfo_overlap_check(mem_banks[i], region_start, region_size) )
+ return true;
/* Check if input region is overlapping with bootmodules */
if ( bootmodules_overlap_check(&bootinfo.modules,
region_start, region_size) )
return true;
-#ifdef CONFIG_ACPI
- /* Check if input region is overlapping with ACPI EfiACPIReclaimMemory */
- if ( meminfo_overlap_check(bootinfo_get_acpi(), region_start, region_size) )
- return true;
-#endif
-
return false;
}
The function check_reserved_regions_overlap is calling 'meminfo_overlap_check' on the same type of structure, this code can be written in a way to avoid code duplication, so rework the function to do that. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> --- v2: - no changes v1: - new patch --- --- xen/arch/arm/setup.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)