From patchwork Thu Mar 29 23:18:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 10316657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7D30660383 for ; Thu, 29 Mar 2018 23:18:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F5992894E for ; Thu, 29 Mar 2018 23:18:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53B9E2A41F; Thu, 29 Mar 2018 23:18:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=2.0 tests=BAYES_40, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E4F0C2894E for ; Thu, 29 Mar 2018 23:18:46 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2647B225501DC; Thu, 29 Mar 2018 16:12:06 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=vishal.l.verma@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E89AE225501C8 for ; Thu, 29 Mar 2018 16:12:04 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2018 16:18:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,378,1517904000"; d="scan'208";a="46452608" Received: from littlefp-mobl.amr.corp.intel.com (HELO vverma7-mobl4.lm.intel.com) ([10.252.136.18]) by orsmga002.jf.intel.com with ESMTP; 29 Mar 2018 16:18:44 -0700 From: Vishal Verma To: Subject: [ndctl PATCH 1/3] ndctl, check: fix a few error returns Date: Thu, 29 Mar 2018 17:18:34 -0600 Message-Id: <20180329231836.29453-1-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.14.3 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Vishal Verma Reviewed-by: Dan Williams --- 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; }