diff mbox series

[6/6] mm/memblock: return true directly on finding overlap region

Message ID 20240414004531.6601-6-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series [1/6] mm/memblock: reduce the two round insertion of memblock_add_range() | expand

Commit Message

Wei Yang April 14, 2024, 12:45 a.m. UTC
Not necessary to break and check i against type->cnt again.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 mm/memblock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/mm/memblock.c b/mm/memblock.c
index 3fecee4bd41a..77719126208a 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -194,8 +194,8 @@  bool __init_memblock memblock_overlaps_region(struct memblock_type *type,
 	for (i = 0; i < type->cnt; i++)
 		if (memblock_addrs_overlap(base, size, type->regions[i].base,
 					   type->regions[i].size))
-			break;
-	return i < type->cnt;
+			return true;
+	return false;
 }
 
 /**