]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
nvdimm: Remove dead code for ENODEV checking in scan_labels()
authorLi Zhijian <lizhijian@fujitsu.com>
Mon, 19 Aug 2024 06:20:45 +0000 (14:20 +0800)
committerIra Weiny <ira.weiny@intel.com>
Wed, 21 Aug 2024 21:06:43 +0000 (16:06 -0500)
The only way create_namespace_pmem() returns an ENODEV code is if
select_pmem_id(nd_region, &uuid) returns ENODEV when its 2nd parameter
is a null pointer. However, this is impossible because &uuid is always
valid.

Furthermore, create_namespace_pmem() is the only user of
select_pmem_id(), it's safe to remove the 'return -ENODEV' branch.

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://patch.msgid.link/20240819062045.1481298-2-lizhijian@fujitsu.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
drivers/nvdimm/namespace_devs.c

index 35d9f3cc2efabf900e23263ce7f9bf347be3f034..55cfbf1e0a95611e662c6e277e0831fb2ed5b0d8 100644 (file)
@@ -1612,9 +1612,6 @@ static int select_pmem_id(struct nd_region *nd_region, const uuid_t *pmem_id)
 {
        int i;
 
-       if (!pmem_id)
-               return -ENODEV;
-
        for (i = 0; i < nd_region->ndr_mappings; i++) {
                struct nd_mapping *nd_mapping = &nd_region->mapping[i];
                struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
@@ -1790,9 +1787,6 @@ static struct device *create_namespace_pmem(struct nd_region *nd_region,
        case -EINVAL:
                dev_dbg(&nd_region->dev, "invalid label(s)\n");
                break;
-       case -ENODEV:
-               dev_dbg(&nd_region->dev, "label not found\n");
-               break;
        default:
                dev_dbg(&nd_region->dev, "unexpected err: %d\n", rc);
                break;
@@ -1980,9 +1974,6 @@ static struct device **scan_labels(struct nd_region *nd_region)
                        case -EAGAIN:
                                /* skip invalid labels */
                                continue;
-                       case -ENODEV:
-                               /* fallthrough to seed creation */
-                               break;
                        default:
                                goto err;
                        }