Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1575975imu; Sun, 18 Nov 2018 04:49:46 -0800 (PST) X-Google-Smtp-Source: AJdET5dPTdzYbL2wSKtrBStu6hoHTHy2V2NPWc88pYJkUV7uEJlqmQFW8nu4of8eU6b7qtf1Z7Hc X-Received: by 2002:a17:902:bd46:: with SMTP id b6mr18265555plx.231.1542545386934; Sun, 18 Nov 2018 04:49:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542545386; cv=none; d=google.com; s=arc-20160816; b=TMIAMwk/ebsI3WDxwcIpRJJcxoZfM2RSF1m9MBKaG+uWn8EG8gS+Oot++wP8OcpThh 8prYwfuDHZ9f118m8W73MoeK8V4zpvtfKIiLC5slGOpVltf+uOyizXDMmbiAvxWX7YmX r3Fo2r6UjyOA5EkFiUt7d9fkckC2daFK9b8l37wPb6sRo/00zTERDSyz9lgmpnE25JrS QkLDnB5oWIM5FEMUicjiQrvBrysNdR+kePnCENEcMplAFJk0l1AxxaJlo51B/sPrqN7r jRo6YNjUfQHlMMPJyrtsD8GG/LAxSa7CxLXr/WhGHI3LZ00VT3/Souk3mw6L1RY2+mXf qI5Q== 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=aGvWANpMMN18bpuRK6xAot5+bWCMZ0S8VgAziZ6kKaw=; b=eyt9M06Zno7oe3/+bg6EeK8Dbd0nn5UYO72hrBk5AJbPkFePQ8xbVmkE81k75cIvZV X+45HkfS4fvnv9rFIJoIioulaVJPql2utH3hiTBPhguJj9PYcDAbmj32XHVL9YQ3c6TJ bGuBn4i9Sy249WJC/my5P50ZheebLoaIWz/5uQdEq8bZfWrGJbFqu4ndDY1NbXobpFzv 1hEmsNgcl8zeqhSP8X8MZTzSPH3C5StLwbOxTxTomAiu3jtk1f1oQD3BYZEMxtwh2Zd4 cm7EZoy2UkFv6TTbsdU6Ap2PrCZajYTadTE3I0mq0mq6gestYx6C8zq6qW7nxI+6mqKM e5pA== 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 f11-v6si36575843plo.199.2018.11.18.04.49.32; Sun, 18 Nov 2018 04:49:46 -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 S1727432AbeKRXIv (ORCPT + 99 others); Sun, 18 Nov 2018 18:08:51 -0500 Received: from mga03.intel.com ([134.134.136.65]:32696 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726180AbeKRXIv (ORCPT ); Sun, 18 Nov 2018 18:08:51 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Nov 2018 04:48:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,248,1539673200"; d="scan'208";a="107258496" Received: from tmuluk-mobl4.ger.corp.intel.com (HELO localhost) ([10.249.254.142]) by fmsmga004.fm.intel.com with ESMTP; 18 Nov 2018 04:48:30 -0800 From: Jarkko Sakkinen To: linux-integrity@vger.kernel.org Cc: linux-security-module@vger.kernel.org, James Bottomley , Tomas Winkler , Tadeusz Struk , Stefan Berger , Nayna Jain , Jarkko Sakkinen , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v9 04/17] tpm: print tpm2_commit_space() error inside tpm2_commit_space() Date: Sun, 18 Nov 2018 14:47:37 +0200 Message-Id: <20181118124753.18613-5-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181118124753.18613-1-jarkko.sakkinen@linux.intel.com> References: <20181118124753.18613-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 --- 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 64510ed81b46..7ac6ada8428c 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