Commit 36a40c37 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Dan Williams
Browse files

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220607152525.33468-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 32346491
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -170,14 +170,11 @@ EXPORT_SYMBOL(nvdimm_namespace_disk_name);

const uuid_t *nd_dev_to_uuid(struct device *dev)
{
	if (!dev)
		return &uuid_null;

	if (is_namespace_pmem(dev)) {
	if (dev && is_namespace_pmem(dev)) {
		struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);

		return nspm->uuid;
	} else
	}
	return &uuid_null;
}
EXPORT_SYMBOL(nd_dev_to_uuid);