tpmdd-devel Archive mirror
 help / color / mirror / Atom feed
From: Ken Goldman <kgoldman-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: What does error code 38 mean? -> hex vs. decimal
Date: Wed, 26 Apr 2017 16:57:07 -0400	[thread overview]
Message-ID: <odr1is$s8a$1@blaine.gmane.org> (raw)
In-Reply-To: <20170426191808.kkvbg4iynbwysu6k@rhwork>

On 4/26/2017 3:18 PM, Jerry Snitselaar wrote:
>
> Maybe the following?
>
>
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index bd2128e0b56c..e6e60f9f428c 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -453,9 +453,14 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *buf,
>                 return -EFAULT;
>
>         err = be32_to_cpu(header->return_code);
> -       if (err != 0 && desc)
> -               dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err,
> -                       desc);
> +       if (err != 0 && desc) {
> +               if (chip->flags & TPM_CHIP_FLAG_TPM2)
> +                       dev_err(&chip->dev, "A TPM error (0x%x) occurred %s\n", err,
> +                               desc);
> +               else
> +                       dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err,
> +                               desc);
> +       }
>         if (err)
>                 return err;
>

I think that's a good idea.

I have a utility that parses the fields out of the TPM 2.0 error codes 
and prints the text.  It expects hex values, as does the specification.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

      reply	other threads:[~2017-04-26 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24  1:32 What does error code 38 mean? Peter Huewe
2017-04-24 14:50 ` Paul Menzel
     [not found]   ` <0603ee8e-ce81-9a46-4bb3-5fe4d7bda463-KUpvgZVWgV9o1qOY/usvUg@public.gmane.org>
2017-04-26 17:52     ` Ken Goldman
2017-04-26 17:57 ` What does error code 38 mean? -> hex vs. decimal Ken Goldman
2017-04-26 19:18   ` Jerry Snitselaar
2017-04-26 20:57     ` Ken Goldman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='odr1is$s8a$1@blaine.gmane.org' \
    --to=kgoldman-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).