nvdimm: Remove empty if statement
authorAlexander Duyck <alexander.h.duyck@linux.intel.com>
Wed, 10 Oct 2018 23:39:06 +0000 (16:39 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 12 Oct 2018 15:39:15 +0000 (08:39 -0700)
This patch removes an empty statement from an if expression and promotes
the else statement to the if expression with the expression logic reversed.

I feel this is more readable as the empty statement can lead to issues if
any additional logic was ever added.

Reviewed-by: Toshi Kani <toshi.kani@hpe.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/nvdimm/label.c

index bb813b8e8aceaab81eaea49cbd11da358e80c108..43bad0d5bdb619bf933c2304c4c2cdf2e965f4b4 100644 (file)
@@ -261,9 +261,8 @@ int nd_label_validate(struct nvdimm_drvdata *ndd)
 void nd_label_copy(struct nvdimm_drvdata *ndd, struct nd_namespace_index *dst,
                struct nd_namespace_index *src)
 {
 void nd_label_copy(struct nvdimm_drvdata *ndd, struct nd_namespace_index *dst,
                struct nd_namespace_index *src)
 {
-       if (dst && src)
-               /* pass */;
-       else
+       /* just exit if either destination or source is NULL */
+       if (!dst || !src)
                return;
 
        memcpy(dst, src, sizeof_namespace_index(ndd));
                return;
 
        memcpy(dst, src, sizeof_namespace_index(ndd));