Skip to content

Commit 36a40c3

Browse files
andy-shevdjbw
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Williams <[email protected]>
1 parent 3234649 commit 36a40c3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/nvdimm/namespace_devs.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,12 @@ EXPORT_SYMBOL(nvdimm_namespace_disk_name);
170170

171171
const uuid_t *nd_dev_to_uuid(struct device *dev)
172172
{
173-
if (!dev)
174-
return &uuid_null;
175-
176-
if (is_namespace_pmem(dev)) {
173+
if (dev && is_namespace_pmem(dev)) {
177174
struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
178175

179176
return nspm->uuid;
180-
} else
181-
return &uuid_null;
177+
}
178+
return &uuid_null;
182179
}
183180
EXPORT_SYMBOL(nd_dev_to_uuid);
184181

0 commit comments

Comments
 (0)