From: Liam R. Howlett Date: Fri, 17 Jul 2020 21:25:05 +0000 (-0400) Subject: maple_tree: Cleaning X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1826d2902c790f7943303cd46db466c43d1f1ac2;p=users%2Fjedix%2Flinux-maple.git maple_tree: Cleaning Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 351cd000c6837..515d4f7de278a 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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;