From: Liam R. Howlett Date: Thu, 22 Oct 2020 18:46:42 +0000 (-0400) Subject: maple_tree: clean up a few small things X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bad5a5759caf98941dbaef4aceaf9efea184c895;p=users%2Fjedix%2Flinux-maple.git maple_tree: clean up a few small things Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f8f94474eced..ca625e142332 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -923,15 +923,15 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp) success = allocated = node->total; while(requested) { void **slots = (void**)&node->slot; - unsigned int max_off = MAPLE_NODE_SLOTS - 1; + unsigned int max_req = MAPLE_NODE_SLOTS - 1; if (node->slot[0]) { unsigned int offset = node->node_count + 1; slots = (void**)&node->slot[offset]; - max_off -= offset; + max_req -= offset; } - count = min(requested, max_off); + count = min(requested, max_req); count = mt_alloc_bulk(gfp, count, slots); if (!count) goto nomem; @@ -961,9 +961,8 @@ static inline void mas_free(struct ma_state *mas, struct maple_enode *used) { if (mt_in_rcu(mas->tree)) mte_free(used); - else { + else mas_push_node(mas, used); - } } // Free the allocations. @@ -4351,11 +4350,8 @@ void *mas_find(struct ma_state *mas, unsigned long max) unsigned long index = mas->min; void *entry = NULL; - while (mas_search_cont(mas, index, max, entry)) { + while (mas_search_cont(mas, index, max, entry)) entry = _mas_next(mas, max, &index); - if (!entry) - entry = NULL; - } if (entry) mas->index = index;