From eae5acbd7572f2874cd2f04dd540870dca256826 Mon Sep 17 00:00:00 2001 From: Yury Norov Date: Sun, 24 Sep 2023 19:38:13 -0700 Subject: [PATCH] bitmap: replace _reg_op(REG_OP_ALLOC) with bitmap_set() _reg_op(REG_OP_ALLOC) duplicates bitmap_set(). CC: Andy Shevchenko CC: Rasmus Villemoes Signed-off-by: Yury Norov --- lib/bitmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/bitmap.c b/lib/bitmap.c index a0b02974d898..8ee7d4857179 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -838,9 +838,12 @@ EXPORT_SYMBOL(bitmap_release_region); */ int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order) { + unsigned int len = BIT(order); + if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) return -EBUSY; - return __reg_op(bitmap, pos, order, REG_OP_ALLOC); + bitmap_set(bitmap, pos, len); + return 0; } EXPORT_SYMBOL(bitmap_allocate_region); -- 2.25.1