[PATCH 7/9] XArray: the NULL xa_node condition is handled in xas_top

Wei Yang
2020-03-30T12:37:42Z

From the last if/else check, it handles the NULL/non-NULL xa_node
mutually exclusively. While the NULL xa_node case is handled in the
first condition xas_top().

Just remove the redundant handling for NULL xa_node.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
lib/xarray.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/xarray.c b/lib/xarray.c
index 0c5b44def3aa..82570bbbf2a5 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -650,16 +650,12 @@ static void *xas_create(struct xa_state *xas, bool allow_root)
slot = &xa->xa_head;
} else if (xas_error(xas)) {
return NULL;
- } else if (node) {
+ } else {
unsigned int offset = xas->xa_offset;

shift = node->shift;
entry = xa_entry_locked(xa, node, offset);
slot = &node->slots[offset];
- } else {
- shift = 0;
- entry = xa_head_locked(xa);
- slot = &xa->xa_head;
}

while (shift > order) {
--
2.23.0