Merge branch 'for-6.1/nvdimm' into libnvdimm-for-next
[sfrench/cifs-2.6.git] / drivers / nvdimm / namespace_devs.c
index 847816992b9e69288a2fa3d6d9db87e2a97d4539..90eefa0ee64de5ac549c4cc6196a0f246db3880b 100644 (file)
@@ -170,15 +170,12 @@ 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;
+       }
+       return &uuid_null;
 }
 EXPORT_SYMBOL(nd_dev_to_uuid);
 
@@ -839,7 +836,6 @@ static ssize_t size_store(struct device *dev,
 {
        struct nd_region *nd_region = to_nd_region(dev->parent);
        unsigned long long val;
-       uuid_t **uuid = NULL;
        int rc;
 
        rc = kstrtoull(buf, 0, &val);
@@ -853,16 +849,12 @@ static ssize_t size_store(struct device *dev,
        if (rc >= 0)
                rc = nd_namespace_label_update(nd_region, dev);
 
-       if (is_namespace_pmem(dev)) {
+       /* setting size zero == 'delete namespace' */
+       if (rc == 0 && val == 0 && is_namespace_pmem(dev)) {
                struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
 
-               uuid = &nspm->uuid;
-       }
-
-       if (rc == 0 && val == 0 && uuid) {
-               /* setting size zero == 'delete namespace' */
-               kfree(*uuid);
-               *uuid = NULL;
+               kfree(nspm->uuid);
+               nspm->uuid = NULL;
        }
 
        dev_dbg(dev, "%llx %s (%d)\n", val, rc < 0 ? "fail" : "success", rc);