summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.c
diff options
context:
space:
mode:
authorKylene Jo Hall <kjhall@us.ibm.com>2005-06-23 22:02:10 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 00:05:27 -0700
commit34d6e07570ef74b965131452a862b13dfa779188 (patch)
tree74086d4c88ed889ac1d0b26cc76d3fe42264e639 /drivers/char/tpm/tpm.c
parente234bc970451edc4021637fe2979b887da873f9a (diff)
downloadop-kernel-dev-34d6e07570ef74b965131452a862b13dfa779188.zip
op-kernel-dev-34d6e07570ef74b965131452a862b13dfa779188.tar.gz
[PATCH] tpm: improve output in sysfs files when the TPM fails
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 <kjhall@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r--drivers/char/tpm/tpm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 785dce6..5c843c9 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -147,7 +147,7 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
memcpy(data, cap_pcr, sizeof(cap_pcr));
if ((len = tpm_transmit(chip, data, sizeof(data)))
< CAP_PCR_RESULT_SIZE) {
- dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred "
+ dev_dbg(&chip->pci_dev->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, struct device_attribute *attr,
memcpy(data + 10, &index, 4);
if ((len = tpm_transmit(chip, data, sizeof(data)))
< READ_PCR_RESULT_SIZE){
- dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred"
+ dev_dbg(&chip->pci_dev->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 *dev, struct device_attribute *attr,
if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) <
READ_PUBEK_RESULT_SIZE) {
- dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred "
+ dev_dbg(&chip->pci_dev->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 *dev, struct device_attribute *attr,
str += sprintf(str, "\n");
}
rc = str - buf;
+out:
kfree(data);
return rc;
}
OpenPOWER on IntegriCloud