nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH 1/3] ndctl, check: fix a few error returns
@ 2018-03-29 23:18 Vishal Verma
  2018-03-29 23:18 ` [ndctl PATCH 2/3] ndctl, inject-smart: fix usage of strerror(errno) Vishal Verma
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Vishal Verma @ 2018-03-29 23:18 UTC (permalink / raw)
  To: linux-nvdimm

We were returning a raw '-1' in one case, and a couple of other 'errno'
returns without making them negative. Fix them to make the returns
consistent.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/check.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ndctl/check.c b/ndctl/check.c
index 57bbf3f..d2d74a2 100644
--- a/ndctl/check.c
+++ b/ndctl/check.c
@@ -139,7 +139,7 @@ static int btt_write_info(struct btt_chk *bttc, struct btt_sb *btt_sb, u64 off)
 		err(bttc, "BTT info block at offset %#lx needs to be restored\n",
 			off);
 		repair_msg(bttc);
-		return -1;
+		return -EIO;
 	}
 	info(bttc, "Restoring BTT info block at offset %#lx\n", off);
 
@@ -184,7 +184,7 @@ static int btt_copy_to_info2(struct arena_info *a)
 	ms_align = (void *)rounddown((u64)a->map.info2, a->bttc->sys_page_size);
 	ms_size = max(BTT_INFO_SIZE, a->bttc->sys_page_size);
 	if (msync(ms_align, ms_size, MS_SYNC) < 0)
-		return errno;
+		return -errno;
 
 	return 0;
 }
@@ -231,7 +231,7 @@ static int btt_map_write(struct arena_info *a, u32 lba, u32 mapping)
 	ms_align = (void *)rounddown((u64)&a->map.map[lba],
 		a->bttc->sys_page_size);
 	if (msync(ms_align, a->bttc->sys_page_size, MS_SYNC) < 0)
-		return errno;
+		return -errno;
 
 	return 0;
 }
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2018-03-29 23:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29 23:18 [ndctl PATCH 1/3] ndctl, check: fix a few error returns Vishal Verma
2018-03-29 23:18 ` [ndctl PATCH 2/3] ndctl, inject-smart: fix usage of strerror(errno) Vishal Verma
2018-03-29 23:28   ` Dan Williams
2018-03-29 23:18 ` [ndctl PATCH 3/3] ndctl: replace direct errno prints with strerror strings Vishal Verma
2018-03-29 23:29   ` Dan Williams
2018-03-29 23:27 ` [ndctl PATCH 1/3] ndctl, check: fix a few error returns 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).