Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5600018ima; Tue, 5 Feb 2019 14:48:53 -0800 (PST) X-Google-Smtp-Source: AHgI3IbpLgKGPYVpwM61bvfv6ipZ1yGYOON8wcJ1ltTAy10wsFmaFac8wBTk+dylR0Lcq+qYyhEY X-Received: by 2002:a17:902:7107:: with SMTP id a7mr7483462pll.290.1549406933810; Tue, 05 Feb 2019 14:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549406933; cv=none; d=google.com; s=arc-20160816; b=gGFTFSCv1UjBbp1R3xT9/WGDsAAsISkpcqCRCTL7dbLuiMZLnFJsYbfK8bsLOuVCX7 24XBjwyBhykV/Qfvs4lddvIWkKMyR3tGLZhzvbX1UpX+GHfYMfuwELHlRAa6TECIAtPA 9ePrXlYmE9A634oCsWaCnjjH6xAN/PgYnRQZcLf/GMd6JpzAfzE3XmLK4SCA/+27azzn /laFWhaPD+bk2J2R7gLaTsLXotKmhUTZDfsAORGSByRDQCziPuYvwMTAVx+W04y+qyzG gVhMDgGU++zyFzY7/XdktN7rqcQ6+/mRhjLlofiyUAy11AB0E/Gd08hyXmotHzNrjJ9G okYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YqJ4s5DoPqEdAJ+r+PQiw/ghLfkFsIVXjrb7jg3CdpE=; b=bx5JJh8CcdVLDAaFrfvfHO7J6bjwnagp0EHnrO+jCSK3GCSs54IuugCr3usZ3VyODu dPs7z9YASIP7dTY2YyVi+20HRegCDEakmmds8bO0A12obX4sqX07X6l93tVcRtD2ySvh Ak5PCNp6zU36Ch92smIATw9ISIy1yRn8irI76kP/C2g27AYQNOS/Ez+K7GbIDGAjK7f1 FTP3///BJDK72oiDKJOrGdRKhZvwSwhNi4pQN5BRBTYAUSTbWPeOBdroMZN1z4vVhUgW jjFawXUP5TBfWMFA4BArj8Wbs630lhYtL4aEtcGJJv8/apDkHrWYKj2vtnMmc7Zbbwja mnvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e33si487382pld.397.2019.02.05.14.48.38; Tue, 05 Feb 2019 14:48:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730765AbfBEWsE (ORCPT + 99 others); Tue, 5 Feb 2019 17:48:04 -0500 Received: from mga03.intel.com ([134.134.136.65]:37645 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730368AbfBEWsC (ORCPT ); Tue, 5 Feb 2019 17:48:02 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2019 14:48:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,337,1544515200"; d="scan'208";a="113982141" Received: from ibanaga-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.254.171]) by orsmga006.jf.intel.com with ESMTP; 05 Feb 2019 14:47:55 -0800 From: Jarkko Sakkinen To: linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Peter Huewe , Jason Gunthorpe , Tomas Winkler , Tadeusz Struk , Stefan Berger , Nayna Jain , Jarkko Sakkinen , James Bottomley Subject: [PATCH v11 04/16] tpm: print tpm2_commit_space() error inside tpm2_commit_space() Date: Wed, 6 Feb 2019 00:47:11 +0200 Message-Id: <20190205224723.19671-5-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190205224723.19671-1-jarkko.sakkinen@linux.intel.com> References: <20190205224723.19671-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The error logging for tpm2_commit_space() is in a wrong place. This commit moves it inside that function. Cc: James Bottomley Signed-off-by: Jarkko Sakkinen Reviewed-by: Stefan Berger Tested-by: Stefan Berger Reviewed-by: Jerry Snitselaar Reviewed-by: James Bottomley --- drivers/char/tpm/tpm-interface.c | 2 -- drivers/char/tpm/tpm2-space.c | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 5ef5c1e6947d..d594ea27810c 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -277,8 +277,6 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, } rc = tpm2_commit_space(chip, space, ordinal, buf, &len); - if (rc) - dev_err(&chip->dev, "tpm2_commit_space: error %d\n", rc); out: /* may fail but do not override previous error value in rc */ diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c index 1131a8e7b79b..5ecc73988f7c 100644 --- a/drivers/char/tpm/tpm2-space.c +++ b/drivers/char/tpm/tpm2-space.c @@ -501,19 +501,19 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, rc = tpm2_map_response_header(chip, cc, buf, *bufsiz); if (rc) { tpm2_flush_space(chip); - return rc; + goto out; } rc = tpm2_map_response_body(chip, cc, buf, *bufsiz); if (rc) { tpm2_flush_space(chip); - return rc; + goto out; } rc = tpm2_save_space(chip); if (rc) { tpm2_flush_space(chip); - return rc; + goto out; } *bufsiz = be32_to_cpu(header->length); @@ -526,4 +526,7 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, memcpy(space->session_buf, chip->work_space.session_buf, PAGE_SIZE); return 0; +out: + dev_err(&chip->dev, "%s: error %d\n", __func__, rc); + return rc; } -- 2.19.1