Skip to contentSkip to conversation

daxctl: phys_index value 0 is valid

PATCH In review Aneesh Kumar K.V 2 participants 3 messages Oct 20, 2020 – Nov 9, 2020 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 daxctl: phys_index value 0 is valid

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.

---
 daxctl/lib/libdaxctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
daxctl/lib/libdaxctl.c +1 -1
index ee4a069eb463..3cb89c755978 100644
@@ -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));
Signature · 4 lines
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
#1 lore raw

Hi All,

Quoted 9 lines · Aneesh Kumar K.V

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.

A gentle ping for this patch. Will appreciate a feedback on this

Quoted 21 lines
---
 daxctl/lib/libdaxctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
daxctl/lib/libdaxctl.c +1 -1
index ee4a069eb463..3cb89c755978 100644
@@ -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));
Signature · 1 line
2.26.2

_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]

Reviewed-by
#2 lore raw
Quoted 10 lines · Aneesh Kumar K.V

Hi All,

Quoted 4 lines · Aneesh Kumar K.V

On power platforms we can find

 # cat /sys/devices/system/memory/memory0/phys_index
00000000
Quoted 8 lines
Quoted 5 lines

This results in

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

Avoid considering phys_index == 0 as error.

A gentle ping for this patch. Will appreciate a feedback on this

Looks good to me. Apologies for the delay.

_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]