1

bitmap: fix opencoded bitmap_allocate_region()

bitmap_find_region() opencodes bitmap_allocate_region().

CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
CC: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
This commit is contained in:
Yury Norov 2023-09-24 19:38:12 -07:00
parent 6d5d3a0c33
commit b085f969ed

View File

@ -803,10 +803,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 */ unsigned int pos, end; /* scans bitmap by regions of size order */
for (pos = 0; (end = pos + BIT(order)) <= bits; pos = end) { for (pos = 0; (end = pos + BIT(order)) <= bits; pos = end) {
if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) if (!bitmap_allocate_region(bitmap, pos, order))
continue; return pos;
__reg_op(bitmap, pos, order, REG_OP_ALLOC);
return pos;
} }
return -ENOMEM; return -ENOMEM;
} }