The return number of daxctl_memory_op(MEM_GET_ZONE) indicates
how many memory blocks have the same memory zone. So It's wrong
to compare mem->zone and zone only when zero is returned.

Signed-off-by: Xiao Yang <[email protected]>
---
 daxctl/lib/libdaxctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
index b27a8af..4f9aba0 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -1616,7 +1616,7 @@ static int daxctl_memory_online_with_zone(struct 
daxctl_memory *mem,
         */
        mem->zone = 0;
        rc = daxctl_memory_op(mem, MEM_GET_ZONE);
-       if (rc)
+       if (rc < 0)
                return rc;
        if (mem->zone != zone) {
                err(ctx,
-- 
2.40.0


Reply via email to