From patchwork Tue Mar 28 23:14:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9650639 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 2E40B602C8 for ; Tue, 28 Mar 2017 23:19:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FC6A2844E for ; Tue, 28 Mar 2017 23:19:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14A1128452; Tue, 28 Mar 2017 23:19:30 +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=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no 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 C34202844E for ; Tue, 28 Mar 2017 23:19:29 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BB540208F7C2F; Tue, 28 Mar 2017 16:19:29 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 1380F21DFA7BA for ; Tue, 28 Mar 2017 16:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490743168; x=1522279168; h=subject:from:to:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=t/gt5sxW1B4hkOHAIi0DoplKMwD3nDzCaTVH+AROhJk=; b=HMmAO7tMwHN8oXhIYMp6Axr4xC/IONqGhNHCLv4LXT69eDkCEmEe2EQB k64+AGSLQEs1QDjaTn1T5VD/29jLpw==; Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2017 16:19:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,238,1486454400"; d="scan'208";a="241420996" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by fmsmga004.fm.intel.com with ESMTP; 28 Mar 2017 16:19:27 -0700 Subject: [ndctl PATCH 5/6] ndctl, dimm: fix count display in the presence of errors From: Dan Williams To: linux-nvdimm@lists.01.org Date: Tue, 28 Mar 2017 16:14:17 -0700 Message-ID: <149074285782.18735.18215464978773558065.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <149074283171.18735.16381597942269607973.stgit@dwillia2-desk3.amr.corp.intel.com> References: <149074283171.18735.16381597942269607973.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP The dimm commands return zero when some operations succeed, return the count separately from the error code. Before: # ndctl zero-labels all zeroed 0 nmem After: # ndctl zero-labels all zeroed 6 nmems Signed-off-by: Dan Williams --- ndctl/dimm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ndctl/dimm.c b/ndctl/dimm.c index b20a84911489..4d25417fb2ae 100644 --- a/ndctl/dimm.c +++ b/ndctl/dimm.c @@ -952,9 +952,9 @@ static int dimm_action(int argc, const char **argv, void *ctx, * count if some actions succeeded, 0 if none were attempted, * negative error code otherwise. */ - if (rc < 0) - return rc; - return count; + if (count > 0) + return count; + return rc; } int cmd_write_labels(int argc, const char **argv, void *ctx)