From: Wei Yang Date: Fri, 13 Sep 2024 06:31:28 +0000 (+0000) Subject: maple_tree: root node could be handled by !p_slot too X-Git-Tag: v6.13-rc1~99^2~135 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0cc8d68abe2fdcb7039ece95f784698c0b0dc51e;p=thirdparty%2Fkernel%2Flinux.git maple_tree: root node could be handled by !p_slot too For a root node, mte_parent_slot() return 0, this exactly fits the following !p_slot check. So we can remove the special handling for root node. Link: https://lkml.kernel.org/r/20240913063128.27391-1-richard.weiyang@gmail.com Signed-off-by: Wei Yang Reviewed-by: Liam R. Howlett Signed-off-by: Andrew Morton --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index cdac15168405b..c2d3c8d273584 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2155,9 +2155,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas) { unsigned int p_slot = mte_parent_slot(mas->node); - if (mte_is_root(mas->node)) - return false; - + /* For root node, p_slot is set to 0 by mte_parent_slot(). */ if (!p_slot) return false;