diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-06-07 18:37:50 +0300 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2022-07-14 11:28:26 -0700 |
commit | 53fc59511fc4c567342b2ef3f7b99a086430e0b4 (patch) | |
tree | d5370d72dd2944298ba23a921497c8e4b7958a6a /drivers/nvdimm | |
parent | 36a40c37389c7a1bef3f1024c55c056304acf439 (diff) | |
download | linux-stable-53fc59511fc4c567342b2ef3f7b99a086430e0b4.tar.gz linux-stable-53fc59511fc4c567342b2ef3f7b99a086430e0b4.tar.bz2 linux-stable-53fc59511fc4c567342b2ef3f7b99a086430e0b4.zip |
nvdimm/namespace: drop unneeded temporary variable in size_store()
Refactor size_store() in order to remove temporary variable on stack
by joining conditionals.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220607153750.33639-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r-- | drivers/nvdimm/namespace_devs.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index 3dae17c90e8c..0f863fda56e6 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c @@ -836,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); @@ -850,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); |