lkml.org 
[lkml]   [2020]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 8/9] XArray: take xas_error() handling for clearer logic
Date
If xas is already in error state, return NULL directly.

Take this logic out instead of burying in the middle to make the logic
more straight forward.

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

diff --git a/lib/xarray.c b/lib/xarray.c
index 82570bbbf2a5..01f64a000e14 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -636,6 +636,9 @@ static void *xas_create(struct xa_state *xas, bool allow_root)
int shift;
unsigned int order = xas->xa_shift;

+ if (xas_error(xas))
+ return NULL;
+
if (xas_top(node)) {
entry = xa_head_locked(xa);
xas->xa_node = NULL;
@@ -648,8 +651,6 @@ static void *xas_create(struct xa_state *xas, bool allow_root)
shift = XA_CHUNK_SHIFT;
entry = xa_head_locked(xa);
slot = &xa->xa_head;
- } else if (xas_error(xas)) {
- return NULL;
} else {
unsigned int offset = xas->xa_offset;

--
2.23.0
\
 
 \ /
  Last update: 2020-03-30 14:38    [W:0.216 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site