[PATCH 5/6] bitmap: fix opencoded bitmap_allocate_region()
From: Yury Norov
Date: Thu Oct 27 2022 - 21:49:06 EST
bitmap_find_region() opencodes bitmap_allocate_region(). Fix it.
Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
---
lib/bitmap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 389446b6f248..2a85fe16f3fa 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -1315,10 +1315,8 @@ int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order)
unsigned int pos, end; /* scans bitmap by regions of size order */
for (pos = 0 ; (end = pos + (1U << order)) <= bits; pos = end) {
- if (!bitmap_empty_from(bitmap, pos, pos + BIT(order)))
- continue;
- bitmap_set(bitmap, pos, pos + BIT(order));
- return pos;
+ if (!bitmap_allocate_region(bitmap, pos, order))
+ return pos;
}
return -ENOMEM;
}
--
2.34.1