Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631777

[PATCH] tpm: print tpm error code in hex for TPM2.0 devices

From Jerry Snitselaar <jsnitsel@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] tpm: print tpm error code in hex for TPM2.0 devices
Date 2017-04-27 00:50 +0200
Message-ID <tADV0-jp-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


For easier decoding, output the error code returned
from the tpm device in hex when the device is TPM2.0.

Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Peter Huewe <peterhuewe@gmx.de>
Cc: Marcel Selhorst <tpmdd@selhorst.net>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reported-by: Ken Goldman <kgoldman@us.ibm.com>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 drivers/char/tpm/tpm-interface.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index bd2128e0b56c..b6c67eef9ae7 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 2.0 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;
 
-- 
2.13.0.rc0.45.ge2cb6ab84

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] tpm: print tpm error code in hex for TPM2.0 devices Jerry Snitselaar <jsnitsel@redhat.com> - 2017-04-27 00:50 +0200
  Re: [PATCH] tpm: print tpm error code in hex for TPM2.0 devices Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-04-28 14:10 +0200
    Re: [PATCH] tpm: print tpm error code in hex for TPM2.0 devices Jerry Snitselaar <jsnitsel@redhat.com> - 2017-04-28 19:20 +0200
      Re: [PATCH] tpm: print tpm error code in hex for TPM2.0 devices Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-04-29 13:20 +0200

csiph-web