Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp855248imu; Tue, 20 Nov 2018 08:00:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/XaZnvyFIwYMGu/DwQFn6MENe3Nmf2y0z1hBZpewoa7DNtSVOsVTLLdRMnEcDKhZ6QWnXP8 X-Received: by 2002:a63:1a0c:: with SMTP id a12mr2346528pga.157.1542729607498; Tue, 20 Nov 2018 08:00:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542729607; cv=none; d=google.com; s=arc-20160816; b=XrcOLFHIrmjmLaeSe5szly3pKQai9zoUGz/KxbV2F5JjbRwXOEdYyEkWqIisSP9q6q EMjAxtPFe/AlJpFFWptlvkUZ6F1rJlBlC2vddKd6tjPrUAok+HfWHv67etpMhXtJLh28 dxmCDH4vU4ilNU9HBsS1+7v239vvTmD6Jw40n3h8c5GT/o1gx0tZ502ExyjZCSgs4e7m AvX65EAYebQJUpBv+dHRqeO5iBXYEd1PV4zyXKSrujgCZCa1nLq7gzF2uxc1E1GYtmB2 nbQgHfi0leidzecfpgp3vO5wsvOoGNwVCs7eztU9Wczu/0xP9yLYhWiWr/JdUFArZO8U NEdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Llv4F1cWt0//vFv/hnf4D6YuR/ZLzZRAjlWCQifDihQ=; b=kfjdfBEMjSjUyuPzQbBSdioyB8MvbGxgjWuDMNGIpqpZeDTa7apx4CCOqvOlZ5aEMJ ZoVzumFN9pcwIq09kUf9D+ypeIWqaMrSeRxfYJbT/sN3bkb/rBfYyB0rfGeXTt5EmUG7 Jmko/WxlBzvxkYGBVRaU4qdNahGJtsxGsUrW6bmqhyg9lVr8eCJv6m2cPRpP/aidzcFk mVmbhMHPUwWnTMHGlgZgKfeWzRaJDILh5YRWZDy2v0n2tTbkkz8pHaQuXD4GyVzKySXn VOmi30d3fEmWiSAOR3adn6j/KVYgtbXlwgVO5VMlfi7nFodQyvaeoMsWuo1l7d/6udaL dYCg== 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 d9si29579760pgv.123.2018.11.20.07.59.52; Tue, 20 Nov 2018 08:00:07 -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 S1727736AbeKTXSP (ORCPT + 99 others); Tue, 20 Nov 2018 18:18:15 -0500 Received: from mga07.intel.com ([134.134.136.100]:10011 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbeKTXSP (ORCPT ); Tue, 20 Nov 2018 18:18:15 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2018 04:49:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,257,1539673200"; d="scan'208";a="87850616" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.177]) by fmsmga008.fm.intel.com with ESMTP; 20 Nov 2018 04:49:13 -0800 Date: Tue, 20 Nov 2018 14:49:13 +0200 From: Jarkko Sakkinen To: "Winkler, Tomas" Cc: "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , James Bottomley , "Struk, Tadeusz" , Stefan Berger , Nayna Jain , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , open list Subject: Re: [PATCH v9 04/17] tpm: print tpm2_commit_space() error inside tpm2_commit_space() Message-ID: <20181120124913.GC8813@linux.intel.com> References: <20181118124753.18613-1-jarkko.sakkinen@linux.intel.com> <20181118124753.18613-5-jarkko.sakkinen@linux.intel.com> <5B8DA87D05A7694D9FA63FD143655C1B9DA23561@hasmsx108.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5B8DA87D05A7694D9FA63FD143655C1B9DA23561@hasmsx108.ger.corp.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 19, 2018 at 09:25:22PM +0000, Winkler, Tomas wrote: > > > > > > 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: > Maybe 'out' is too positive name for an error-only exit point? > or you can use if (rc) ... dev_err() out_err? /Jarkko