<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Kylene Jo Hall &lt;kjhall@us.ibm.com&gt;

Since after reconsideration this is more debug output than an error (the
TPM is operating correctly given the current state) I have changed the
statements to dbg rather than err.

Also this patch corrects a memory leak if the error path is taken in the
tpm_show_pubek function.

Signed-off-by: Kylene Hall &lt;kjhall@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 drivers/char/tpm/tpm.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff -puN drivers/char/tpm/tpm.c~tpm-improve-output-in-sysfs-files-when-the-tpm-fails drivers/char/tpm/tpm.c
--- 25/drivers/char/tpm/tpm.c~tpm-improve-output-in-sysfs-files-when-the-tpm-fails	2005-06-14 13:08:53.000000000 -0700
+++ 25-akpm/drivers/char/tpm/tpm.c	2005-06-14 13:08:53.000000000 -0700
@@ -147,7 +147,7 @@ ssize_t tpm_show_pcrs(struct device *dev
 	memcpy(data, cap_pcr, sizeof(cap_pcr));
 	if ((len = tpm_transmit(chip, data, sizeof(data)))
 	    &lt; CAP_PCR_RESULT_SIZE) {
-		dev_err(&amp;chip-&gt;pci_dev-&gt;dev, "A TPM error (%d) occurred "
+		dev_dbg(&amp;chip-&gt;pci_dev-&gt;dev, "A TPM error (%d) occurred "
 				"attempting to determine the number of PCRS\n",
 			be32_to_cpu(*((__be32 *) (data + 6))));
 		return 0;
@@ -161,7 +161,7 @@ ssize_t tpm_show_pcrs(struct device *dev
 		memcpy(data + 10, &amp;index, 4);
 		if ((len = tpm_transmit(chip, data, sizeof(data)))
 		    &lt; READ_PCR_RESULT_SIZE){
-			dev_err(&amp;chip-&gt;pci_dev-&gt;dev, "A TPM error (%d) occurred"
+			dev_dbg(&amp;chip-&gt;pci_dev-&gt;dev, "A TPM error (%d) occurred"
 				" attempting to read PCR %d of %d\n",
 				be32_to_cpu(*((__be32 *) (data + 6))), i, num_pcrs);
 			goto out;
@@ -205,10 +205,11 @@ ssize_t tpm_show_pubek(struct device *de
 
 	if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) &lt;
 	    READ_PUBEK_RESULT_SIZE) {
-		dev_err(&amp;chip-&gt;pci_dev-&gt;dev, "A TPM error (%d) occurred "
+		dev_dbg(&amp;chip-&gt;pci_dev-&gt;dev, "A TPM error (%d) occurred "
 				"attempting to read the PUBEK\n",
 			    be32_to_cpu(*((__be32 *) (data + 6))));
-		return 0;
+		rc = 0;
+		goto out;
 	}
 
 	/* 
@@ -240,6 +241,7 @@ ssize_t tpm_show_pubek(struct device *de
 			str += sprintf(str, "\n");
 	}
 	rc = str - buf;
+out:
 	kfree(data);
 	return rc;
 }
_
</pre></body></html>