]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: clean up a few small things
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 22 Oct 2020 18:46:42 +0000 (14:46 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:30:36 +0000 (12:30 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index f8f94474eced86f94d4d5c2bf01d38a4e9ece5c3..ca625e14233216c01ce3c2758bef13c2e19d624a 100644 (file)
@@ -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;