From cc810de61daf9f724314b624400c4b492f7c669c Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 31 Jan 2019 19:30:44 -0500 Subject: [PATCH] maple_tree: fix goto lables in ma_insert Fix the order of goto labels and set the error correct if using exists. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d012855a2322..05db6c45c34a 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -957,10 +957,8 @@ void ma_insert(struct ma_state *mas, void *entry) slot = ma_get_slot(mas); src = &mt_to_node(mas->node)->mr64; if (leaf == true && slot != MAPLE_NODE_SLOTS) { - if (src->slot[slot]) { - mas_set_err(mas, -EEXIST); + if (src->slot[slot]) goto exists; - } } mas_coalesce(mas); @@ -974,8 +972,9 @@ void ma_insert(struct ma_state *mas, void *entry) return; -error: exists: + mas_set_err(mas, -EEXIST); +error: return; } -- 2.50.1