diff mbox series

[3/7] maple_tree: check mid_split only may have

Message ID 20241127012753.3393-4-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series spanning write related cleanup | expand

Commit Message

Wei Yang Nov. 27, 2024, 1:27 a.m. UTC
We only may set mid_split in the else clause, let's move the check in
it.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
 lib/maple_tree.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 2a00441130ee..f5606b4d0dba 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2381,10 +2381,11 @@  static inline unsigned char mas_mab_to_node(struct ma_state *mas,
 	} else {
 		split = mab_calc_split(mas, b_node, mid_split);
 		*right = mas_new_ma_node(mas, b_node);
+
+		if (*mid_split)
+			*middle = mas_new_ma_node(mas, b_node);
 	}
 
-	if (*mid_split)
-		*middle = mas_new_ma_node(mas, b_node);
 
 	return split;