Skip to content

Commit 0bfb8dd

Browse files
committed
libnvdimm: cleanup nvdimm_namespace_common_probe(), kill 'host'
The 'host' variable can be killed as it is always the same as the passed in device. Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent 5a92289 commit 0bfb8dd

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

drivers/nvdimm/namespace_devs.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,21 +1379,16 @@ struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev)
13791379
{
13801380
struct nd_btt *nd_btt = is_nd_btt(dev) ? to_nd_btt(dev) : NULL;
13811381
struct nd_pfn *nd_pfn = is_nd_pfn(dev) ? to_nd_pfn(dev) : NULL;
1382-
struct nd_namespace_common *ndns;
1382+
struct nd_namespace_common *ndns = NULL;
13831383
resource_size_t size;
13841384

13851385
if (nd_btt || nd_pfn) {
1386-
struct device *host = NULL;
1387-
1388-
if (nd_btt) {
1389-
host = &nd_btt->dev;
1386+
if (nd_btt)
13901387
ndns = nd_btt->ndns;
1391-
} else if (nd_pfn) {
1392-
host = &nd_pfn->dev;
1388+
else if (nd_pfn)
13931389
ndns = nd_pfn->ndns;
1394-
}
13951390

1396-
if (!ndns || !host)
1391+
if (!ndns)
13971392
return ERR_PTR(-ENODEV);
13981393

13991394
/*
@@ -1404,12 +1399,12 @@ struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev)
14041399
device_unlock(&ndns->dev);
14051400
if (ndns->dev.driver) {
14061401
dev_dbg(&ndns->dev, "is active, can't bind %s\n",
1407-
dev_name(host));
1402+
dev_name(dev));
14081403
return ERR_PTR(-EBUSY);
14091404
}
1410-
if (dev_WARN_ONCE(&ndns->dev, ndns->claim != host,
1405+
if (dev_WARN_ONCE(&ndns->dev, ndns->claim != dev,
14111406
"host (%s) vs claim (%s) mismatch\n",
1412-
dev_name(host),
1407+
dev_name(dev),
14131408
dev_name(ndns->claim)))
14141409
return ERR_PTR(-ENXIO);
14151410
} else {

0 commit comments

Comments
 (0)