From 721e1ea2768ffd719646d1fcea4fd1aec4a70909 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Fri, 17 Jul 2020 17:25:05 -0400 Subject: [PATCH] maple_tree: Cleaning Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 351cd000c683..515d4f7de278 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; -- 2.50.1