diff options
author | Dan Williams <dan.j.williams@intel.com> | 2021-09-09 07:11:42 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2021-09-21 22:44:55 +0200 |
commit | 8172db92527c936c638b52274fbd06a0a624a56b (patch) | |
tree | 9cc931dfba36b5cb0350afcc7ae08a1a83fe4b28 /drivers/nvdimm/namespace_devs.c | |
parent | libnvdimm/labels: Add uuid helpers (diff) | |
download | linux-8172db92527c936c638b52274fbd06a0a624a56b.tar.xz linux-8172db92527c936c638b52274fbd06a0a624a56b.zip |
libnvdimm/label: Add a helper for nlabel validation
In the CXL namespace label there is no need for nlabel since that is
inferred from the region. Add a helper that moves nsl_get_label() behind
a helper that validates the number of labels relative to the region.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/163116430293.2460985.12693942353621355232.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/namespace_devs.c')
-rw-r--r-- | drivers/nvdimm/namespace_devs.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index 1415d543c3e3..b57a2d36c517 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c @@ -1848,12 +1848,11 @@ static bool has_uuid_at_pos(struct nd_region *nd_region, const uuid_t *uuid, list_for_each_entry(label_ent, &nd_mapping->labels, list) { struct nd_namespace_label *nd_label = label_ent->label; - u16 position, nlabel; + u16 position; if (!nd_label) continue; position = nsl_get_position(ndd, nd_label); - nlabel = nsl_get_nlabel(ndd, nd_label); if (!nsl_validate_isetcookie(ndd, nd_label, cookie)) continue; @@ -1870,7 +1869,7 @@ static bool has_uuid_at_pos(struct nd_region *nd_region, const uuid_t *uuid, return false; } found_uuid = true; - if (nlabel != nd_region->ndr_mappings) + if (!nsl_validate_nlabel(nd_region, ndd, nd_label)) continue; if (position != pos) continue; |