nvdimm/namespace: return uuid_null only once in nd_dev_to_uuid()
Refactor nd_dev_to_uuid() in order to make code shorter and cleaner by joining conditions and hence returning uuid_null only once. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220607152525.33468-1-andriy.shevchenko@linux.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
32346491dd
commit
36a40c3738
@ -170,15 +170,12 @@ EXPORT_SYMBOL(nvdimm_namespace_disk_name);
|
|||||||
|
|
||||||
const uuid_t *nd_dev_to_uuid(struct device *dev)
|
const uuid_t *nd_dev_to_uuid(struct device *dev)
|
||||||
{
|
{
|
||||||
if (!dev)
|
if (dev && is_namespace_pmem(dev)) {
|
||||||
return &uuid_null;
|
|
||||||
|
|
||||||
if (is_namespace_pmem(dev)) {
|
|
||||||
struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
|
struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
|
||||||
|
|
||||||
return nspm->uuid;
|
return nspm->uuid;
|
||||||
} else
|
}
|
||||||
return &uuid_null;
|
return &uuid_null;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(nd_dev_to_uuid);
|
EXPORT_SYMBOL(nd_dev_to_uuid);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user