[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221028014834.572819-6-yury.norov@gmail.com>
Date: Thu, 27 Oct 2022 18:48:33 -0700
From: Yury Norov <yury.norov@...il.com>
To: linux-kernel@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Yury Norov <yury.norov@...il.com>
Subject: [PATCH 5/6] bitmap: fix opencoded bitmap_allocate_region()
bitmap_find_region() opencodes bitmap_allocate_region(). Fix it.
Signed-off-by: Yury Norov <yury.norov@...il.com>
---
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
Powered by blists - more mailing lists