From f4e1611692067805442e3ad89be268fd8a2eaee4 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 17 Mar 2021 22:31:59 -0400 Subject: [PATCH] lib/os/heap: no need to over-mask bmask already represents the intersection of h->avail_buckets and wanted buckets. Signed-off-by: Nicolas Pitre --- lib/os/heap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/os/heap.c b/lib/os/heap.c index 1083b5b2be4..22ecce05914 100644 --- a/lib/os/heap.c +++ b/lib/os/heap.c @@ -207,8 +207,8 @@ static chunkid_t alloc_chunk(struct z_heap *h, size_t sz) */ size_t bmask = h->avail_buckets & ~((1 << (bi + 1)) - 1); - if ((bmask & h->avail_buckets) != 0U) { - int minbucket = __builtin_ctz(bmask & h->avail_buckets); + if (bmask != 0U) { + int minbucket = __builtin_ctz(bmask); chunkid_t c = h->buckets[minbucket].next; free_list_remove_bidx(h, c, minbucket);