A pmem region that does not have any associated dimm mappings is still a
x1 interleave width by definition. Given that tooling does division by
interleave-ways, return 1 as a minimum so that users do not need to
check for the zero case.

If a user instead wants to know the number of mapping entries that is
provided by ndctl_region_get_mappings().

Signed-off-by: Dan Williams <dan.j.willi...@intel.com>
---
 ndctl/lib/libndctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 49e35bf0fd98..c4a9b3675d89 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -1676,7 +1676,7 @@ NDCTL_EXPORT unsigned int ndctl_region_get_id(struct 
ndctl_region *region)
 
 NDCTL_EXPORT unsigned int ndctl_region_get_interleave_ways(struct ndctl_region 
*region)
 {
-       return ndctl_region_get_mappings(region);
+       return max(1, ndctl_region_get_mappings(region));
 }
 
 NDCTL_EXPORT unsigned int ndctl_region_get_mappings(struct ndctl_region 
*region)

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to