bitmap: fix opencoded bitmap_allocate_region()
authorYury Norov <yury.norov@gmail.com>
Mon, 25 Sep 2023 02:38:12 +0000 (19:38 -0700)
committerYury Norov <yury.norov@gmail.com>
Sun, 15 Oct 2023 03:25:22 +0000 (20:25 -0700)
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>
lib/bitmap.c

index f77243ba5e1c2646ac06a661524244f45c7c6db3..a0b02974d898f241a72d9fa0941529854a1d7b04 100644 (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;
 }