Re: [PATCH 5/8 linux-next] libnvdimm: remove else after return in nsio_rw_bytes()
From: Dan Williams
Date: Fri Dec 02 2016 - 14:59:49 EST
On Fri, Dec 2, 2016 at 11:21 AM, Fabian Frederick <fabf@xxxxxxxxx> wrote:
> else after return is not needed.
>
> Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
> ---
> drivers/nvdimm/claim.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
> index d5dc80c..c0c113e 100644
> --- a/drivers/nvdimm/claim.c
> +++ b/drivers/nvdimm/claim.c
> @@ -238,11 +238,10 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
> if (unlikely(is_bad_pmem(&nsio->bb, offset / 512, sz_align)))
> return -EIO;
> return memcpy_from_pmem(buf, nsio->addr + offset, size);
> - } else {
> - memcpy_to_pmem(nsio->addr + offset, buf, size);
> - nvdimm_flush(to_nd_region(ndns->dev.parent));
> }
>
> + memcpy_to_pmem(nsio->addr + offset, buf, size);
> + nvdimm_flush(to_nd_region(ndns->dev.parent));
> return 0;
> }
Looks good, but this collides with
commit 82bf1037f2cab2d6960a08ae08513f2c3c0b335a
Author: Dave Jiang <dave.jiang@xxxxxxxxx>
Date: Fri Nov 11 12:37:36 2016 -0700
libnvdimm: check and clear poison before writing to pmem
We need to clear any poison when we are writing to pmem. The granularity
will be sector size. If it's less then we can't do anything about it
barring corruption.
Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
Reviewed-by: Vishal Verma <vishal.l.verma@xxxxxxxxx>
[djbw: fixup 0-length write request to succeed]
Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
Can you respin this on top of libnvdimm-pending?
https://git.kernel.org/cgit/linux/kernel/git/djbw/nvdimm.git/log/?h=libnvdimm-pending