NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@fujitsu.com>
To: dave.jiang@intel.com, nvdimm@lists.linux.dev
Cc: linux-cxl@vger.kernel.org, Xiao Yang <yangx.jy@fujitsu.com>
Subject: [PATCH] libdaxctl: Add accurate check for daxctl_memory_op(MEM_GET_ZONE)
Date: Mon,  9 Oct 2023 18:35:21 +0800	[thread overview]
Message-ID: <20231009103521.1463-1-yangx.jy@fujitsu.com> (raw)

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 <yangx.jy@fujitsu.com>
---
 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	other threads:[~2023-10-09 10:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 10:35 Xiao Yang [this message]
2023-10-13 22:27 ` [PATCH] libdaxctl: Add accurate check for daxctl_memory_op(MEM_GET_ZONE) Dave Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231009103521.1463-1-yangx.jy@fujitsu.com \
    --to=yangx.jy@fujitsu.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).