From patchwork Tue Mar 7 21:06:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 9609843 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 E27A7602B4 for ; Tue, 7 Mar 2017 21:06:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0B5D28535 for ; Tue, 7 Mar 2017 21:06:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5B602853E; Tue, 7 Mar 2017 21:06:49 +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.9 required=2.0 tests=BAYES_00, 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 5705B28535 for ; Tue, 7 Mar 2017 21:06:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 716B280367; Tue, 7 Mar 2017 13:06:49 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 DD37780366 for ; Tue, 7 Mar 2017 13:06:48 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 07 Mar 2017 13:06:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,260,1486454400"; d="scan'208";a="233423302" Received: from djiang5-desk3.ch.intel.com ([143.182.137.38]) by fmsmga004.fm.intel.com with ESMTP; 07 Mar 2017 13:06:48 -0800 Subject: [PATCH v2 3/5] acpi: cleanup acpi_nfit_ctl calling xlat_status From: Dave Jiang To: dan.j.williams@intel.com Date: Tue, 07 Mar 2017 14:06:48 -0700 Message-ID: <148892080835.46486.13067994980370510435.stgit@djiang5-desk3.ch.intel.com> In-Reply-To: <148892068983.46486.5008198419806159468.stgit@djiang5-desk3.ch.intel.com> References: <148892068983.46486.5008198419806159468.stgit@djiang5-desk3.ch.intel.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Make sure that xlat_status is unconditionally called. Signed-off-by: Dave Jiang Reviewed-by: Johannes Thumshirn --- drivers/acpi/nfit/core.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 662036b..e7b05df 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -199,7 +199,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, acpi_handle handle; unsigned int func; const u8 *uuid; - int rc, i; + int rc = 0, xlat_rc, i; func = cmd; if (cmd == ND_CMD_CALL) { @@ -343,21 +343,20 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, * unfilled in the output buffer */ rc = buf_len - offset - in_buf.buffer.length; - if (cmd_rc) - *cmd_rc = xlat_status(nvdimm, buf, cmd, - fw_status); } else { dev_err(dev, "%s:%s underrun cmd: %s buf_len: %d out_len: %d\n", __func__, dimm_name, cmd_name, buf_len, offset); rc = -ENXIO; + goto out; } - } else { - rc = 0; - if (cmd_rc) - *cmd_rc = xlat_status(nvdimm, buf, cmd, fw_status); } + xlat_rc = xlat_status(nvdimm, buf, cmd, fw_status); + + if (cmd_rc) + *cmd_rc = xlat_rc; + out: ACPI_FREE(out_obj);