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
1 changed files with 2 additions and 4 deletions

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 */
for (pos = 0; (end = pos + BIT(order)) <= bits; pos = end) {
if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE))
continue;
__reg_op(bitmap, pos, order, REG_OP_ALLOC);
return pos;
if (!bitmap_allocate_region(bitmap, pos, order))
return pos;
}
return -ENOMEM;
}