Skip to content

Commit 447b167

Browse files
zhijianli88weiny2
authored andcommitted
nvdimm: Remove dead code for ENODEV checking in scan_labels()
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 <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Ira Weiny <[email protected]>
1 parent 62c2aa6 commit 447b167

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

drivers/nvdimm/namespace_devs.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,9 +1612,6 @@ static int select_pmem_id(struct nd_region *nd_region, const uuid_t *pmem_id)
16121612
{
16131613
int i;
16141614

1615-
if (!pmem_id)
1616-
return -ENODEV;
1617-
16181615
for (i = 0; i < nd_region->ndr_mappings; i++) {
16191616
struct nd_mapping *nd_mapping = &nd_region->mapping[i];
16201617
struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
@@ -1790,9 +1787,6 @@ static struct device *create_namespace_pmem(struct nd_region *nd_region,
17901787
case -EINVAL:
17911788
dev_dbg(&nd_region->dev, "invalid label(s)\n");
17921789
break;
1793-
case -ENODEV:
1794-
dev_dbg(&nd_region->dev, "label not found\n");
1795-
break;
17961790
default:
17971791
dev_dbg(&nd_region->dev, "unexpected err: %d\n", rc);
17981792
break;
@@ -1980,9 +1974,6 @@ static struct device **scan_labels(struct nd_region *nd_region)
19801974
case -EAGAIN:
19811975
/* skip invalid labels */
19821976
continue;
1983-
case -ENODEV:
1984-
/* fallthrough to seed creation */
1985-
break;
19861977
default:
19871978
goto err;
19881979
}

0 commit comments

Comments
 (0)