Skip to content

Commit

Permalink
tpm: suppress durations sysfs output if not read
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
stefanberger authored and James Morris committed Aug 23, 2011
1 parent 8ad346c commit 403d1d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,9 @@ ssize_t tpm_show_durations(struct device *dev, struct device_attribute *attr,
{
struct tpm_chip *chip = dev_get_drvdata(dev);

if (chip->vendor.duration[TPM_LONG] == 0)
return 0;

return sprintf(buf, "%d %d %d [%s]\n",
jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),
Expand Down

0 comments on commit 403d1d0

Please sign in to comment.