]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Cleaning
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 17 Jul 2020 21:25:05 +0000 (17:25 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 19:05:32 +0000 (15:05 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 351cd000c6837e8613ff2b4d0040df62a089cd6e..515d4f7de278a7851b0abbba8be48774688211cb 100644 (file)
@@ -2955,12 +2955,12 @@ exists:
 }
 void *mas_store(struct ma_state *mas, void *entry)
 {
-       if (mas->index > mas->last) {
-               mas_set_err(mas, -EINVAL);
-               return NULL;
-       }
+       if (mas->index <= mas->last)
+               return _mas_store(mas, entry, true);
+
+       mas_set_err(mas, -EINVAL);
+       return NULL;
 
-       return _mas_store(mas, entry, true);
 }
 static inline int mas_dead_node(struct ma_state *mas, unsigned long index);
 
@@ -2969,7 +2969,6 @@ static inline void mas_next_slot(struct ma_state *mas, unsigned long max)
 {
        unsigned char slot;
 
-       // walk up.
        while (1) {
                slot = mte_parent_slot(mas->node);
                if (mte_is_root(mas->node))
@@ -2990,7 +2989,6 @@ static inline void mas_next_slot(struct ma_state *mas, unsigned long max)
                        goto no_entry;
        }
 
-
 walk_down:
        do {
                void *entry = NULL;
@@ -3003,13 +3001,13 @@ walk_down:
                        goto no_entry;
 
                if (mte_is_leaf(mas->node)) {
-                       goto done;
+                       goto found_next;
                }
                slot = 0;
 
        } while (1);
 
-done:
+found_next:
        mas_set_slot(mas, slot);
        return;