aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2011-08-23 08:52:10 -0400
committerJames Morris <jmorris@namei.org>2011-08-23 19:30:08 -0400
commit403d1d0319ad73b5ccf251745af4c7000331a76b (patch)
tree8f04137c79a0ab9c6e5104ba3bf439c6e9e6bb6a /drivers/char/tpm
parent8ad346c62ae91e6376fb9d199ef8557b0c814209 (diff)
tpm: suppress durations sysfs output if not read
Suppress the output in the 'durations' sysfs entry if they were not read during driver initialization. This is similar to other sysfs entries that return nothing if for some reason sending the commands to the TPM fails. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index caf8012ef47c..e53af7638186 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -963,6 +963,9 @@ ssize_t tpm_show_durations(struct device *dev, struct device_attribute *attr,
963{ 963{
964 struct tpm_chip *chip = dev_get_drvdata(dev); 964 struct tpm_chip *chip = dev_get_drvdata(dev);
965 965
966 if (chip->vendor.duration[TPM_LONG] == 0)
967 return 0;
968
966 return sprintf(buf, "%d %d %d [%s]\n", 969 return sprintf(buf, "%d %d %d [%s]\n",
967 jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]), 970 jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
968 jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]), 971 jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),