lkml.org 
[lkml]   [2018]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 05/17] tpm: print tpm2_commit_space() error inside tpm2_commit_space()
From
Date
On 11/8/18 9:15 AM, Jarkko Sakkinen wrote:
> The error logging for tpm2_commit_space() is in a wrong place. This
> commit moves it inside that function.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>


> ---
> drivers/char/tpm/tpm-interface.c | 8 ++------
> drivers/char/tpm/tpm2-space.c | 9 ++++++---
> 2 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index c9efd1b9fd2c..7ffb16edab6f 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -268,14 +268,10 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip,
> rc = -EFAULT;
>
> out_space:
> - if (rc) {
> + if (rc)
> tpm2_flush_space(chip);
> - } else {
> + else
> rc = tpm2_commit_space(chip, space, ordinal, buf, &len);
> - if (rc)
> - dev_err(&chip->dev, "tpm2_commit_space: error %d\n",
> - rc);
> - }
>
> out_idle:
> /* 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 d53c882268ff..3d5f9577e5de 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;
> }


\
 
 \ /
  Last update: 2018-11-08 15:57    [W:0.240 / U:5.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site