Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: linux-nvdimm@lists.01.org, dan.j.williams@intel.com,
	vishal.l.verma@intel.com
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Subject: [PATCH] daxctl: phys_index value 0 is valid
Date: Tue, 20 Oct 2020 10:57:04 +0530	[thread overview]
Message-ID: <20201020052704.331557-1-aneesh.kumar@linux.ibm.com> (raw)

On power platforms we can find
 # cat /sys/devices/system/memory/memory0/phys_index
00000000

This results in

libdaxctl: memblock_in_dev: dax1.0: memory0: Unable to determine phys_index: Success

Avoid considering phys_index == 0 as error.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.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 ee4a069eb463..3cb89c755978 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -1229,7 +1229,7 @@ static int memblock_in_dev(struct daxctl_memory *mem, const char *memblock)
 	rc = sysfs_read_attr(ctx, path, buf);
 	if (rc == 0) {
 		phys_index = strtoul(buf, NULL, 16);
-		if (phys_index == 0 || phys_index == ULONG_MAX) {
+		if (phys_index == ULONG_MAX) {
 			rc = -errno;
 			err(ctx, "%s: %s: Unable to determine phys_index: %s\n",
 				devname, memblock, strerror(-rc));
-- 
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

             reply	other threads:[~2020-10-20  5:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  5:27 Aneesh Kumar K.V [this message]
2020-11-09  5:11 ` [PATCH] daxctl: phys_index value 0 is valid Aneesh Kumar K.V
2020-11-09 19:08   ` Dan Williams

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=20201020052704.331557-1-aneesh.kumar@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vishal.l.verma@intel.com \
    /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