aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorKylene Jo Hall <kjhall@us.ibm.com>2005-06-24 01:02:10 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:27 -0400
commit34d6e07570ef74b965131452a862b13dfa779188 (patch)
tree74086d4c88ed889ac1d0b26cc76d3fe42264e639 /drivers/char/tpm
parente234bc970451edc4021637fe2979b887da873f9a (diff)
[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')
-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 785dce67942f..5c843c9bf819 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,
147 memcpy(data, cap_pcr, sizeof(cap_pcr)); 147 memcpy(data, cap_pcr, sizeof(cap_pcr));
148 if ((len = tpm_transmit(chip, data, sizeof(data))) 148 if ((len = tpm_transmit(chip, data, sizeof(data)))
149 < CAP_PCR_RESULT_SIZE) { 149 < CAP_PCR_RESULT_SIZE) {
150 dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred " 150 dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred "
151 "attempting to determine the number of PCRS\n", 151 "attempting to determine the number of PCRS\n",
152 be32_to_cpu(*((__be32 *) (data + 6)))); 152 be32_to_cpu(*((__be32 *) (data + 6))));
153 return 0; 153 return 0;
@@ -161,7 +161,7 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
161 memcpy(data + 10, &index, 4); 161 memcpy(data + 10, &index, 4);
162 if ((len = tpm_transmit(chip, data, sizeof(data))) 162 if ((len = tpm_transmit(chip, data, sizeof(data)))
163 < READ_PCR_RESULT_SIZE){ 163 < READ_PCR_RESULT_SIZE){
164 dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred" 164 dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred"
165 " attempting to read PCR %d of %d\n", 165 " attempting to read PCR %d of %d\n",
166 be32_to_cpu(*((__be32 *) (data + 6))), i, num_pcrs); 166 be32_to_cpu(*((__be32 *) (data + 6))), i, num_pcrs);
167 goto out; 167 goto out;
@@ -205,10 +205,11 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr,
205 205
206 if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) < 206 if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) <
207 READ_PUBEK_RESULT_SIZE) { 207 READ_PUBEK_RESULT_SIZE) {
208 dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred " 208 dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred "
209 "attempting to read the PUBEK\n", 209 "attempting to read the PUBEK\n",
210 be32_to_cpu(*((__be32 *) (data + 6)))); 210 be32_to_cpu(*((__be32 *) (data + 6))));
211 return 0; 211 rc = 0;
212 goto out;
212 } 213 }
213 214
214 /* 215 /*
@@ -240,6 +241,7 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr,
240 str += sprintf(str, "\n"); 241 str += sprintf(str, "\n");
241 } 242 }
242 rc = str - buf; 243 rc = str - buf;
244out:
243 kfree(data); 245 kfree(data);
244 return rc; 246 return rc;
245} 247}