linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/3 libnvdimm-pending] libnvdimm: remove else after return in nsio_rw_bytes()
@ 2016-12-03 18:53 Fabian Frederick
  2016-12-04 19:21 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2016-12-03 18:53 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm, linux-kernel, fabf

else after return is not needed.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
V2: -applied on top of libnvdimm-pending

 drivers/nvdimm/claim.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index 4638b9e..75c36c3 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -242,29 +242,28 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
 		if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align)))
 			return -EIO;
 		return memcpy_from_pmem(buf, nsio->addr + offset, size);
-	} else {
-
-		if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align))) {
-			if (IS_ALIGNED(offset, 512) && IS_ALIGNED(size, 512)) {
-				long cleared;
-
-				cleared = nvdimm_clear_poison(&ndns->dev,
-							      offset, size);
-				if (cleared != size) {
-					size = cleared;
-					rc = -EIO;
-				}
-
-				badblocks_clear(&nsio->bb, sector,
-						cleared >> 9);
-			} else
+	}
+
+	if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align))) {
+		if (IS_ALIGNED(offset, 512) && IS_ALIGNED(size, 512)) {
+			long cleared;
+
+			cleared = nvdimm_clear_poison(&ndns->dev,
+						      offset, size);
+			if (cleared != size) {
+				size = cleared;
 				rc = -EIO;
-		}
+			}
 
-		memcpy_to_pmem(nsio->addr + offset, buf, size);
-		nvdimm_flush(to_nd_region(ndns->dev.parent));
+			badblocks_clear(&nsio->bb, sector,
+					cleared >> 9);
+		} else
+			rc = -EIO;
 	}
 
+	memcpy_to_pmem(nsio->addr + offset, buf, size);
+	nvdimm_flush(to_nd_region(ndns->dev.parent));
+
 	return rc;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2 1/3 libnvdimm-pending] libnvdimm: remove else after return in nsio_rw_bytes()
  2016-12-03 18:53 [PATCH V2 1/3 libnvdimm-pending] libnvdimm: remove else after return in nsio_rw_bytes() Fabian Frederick
@ 2016-12-04 19:21 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2016-12-04 19:21 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-nvdimm@lists.01.org, linux-kernel

On Sat, Dec 3, 2016 at 10:53 AM, Fabian Frederick <fabf@skynet.be> wrote:
> else after return is not needed.
>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> V2: -applied on top of libnvdimm-pending
>

Thanks. This one and the other 2 are applied and pushed out to
libnvdimm-pending.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-04 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-03 18:53 [PATCH V2 1/3 libnvdimm-pending] libnvdimm: remove else after return in nsio_rw_bytes() Fabian Frederick
2016-12-04 19:21 ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).