diff options
author | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-11-14 11:00:50 +0100 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-11-28 00:31:31 +0100 |
commit | cd9b7631a888f6615dac148c10d72a253b98c64b (patch) | |
tree | fea727e138e62c981c51158e450f0df4612223ea /drivers/char/tpm/tpm-chip.c | |
parent | tpm: replace symbolic permission with octal for securityfs files (diff) | |
download | linux-cd9b7631a888f6615dac148c10d72a253b98c64b.tar.xz linux-cd9b7631a888f6615dac148c10d72a253b98c64b.zip |
tpm: replace dynamically allocated bios_dir with a static array
This commit is based on a commit by Nayna Jain. Replaced dynamically
allocated bios_dir with a static array as the size is always constant.
Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm-chip.c')
-rw-r--r-- | drivers/char/tpm/tpm-chip.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 836f056f7d27..d0c187269ef4 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -278,14 +278,16 @@ static void tpm_del_char_device(struct tpm_chip *chip) static int tpm1_chip_register(struct tpm_chip *chip) { + int rc; + if (chip->flags & TPM_CHIP_FLAG_TPM2) return 0; tpm_sysfs_add_device(chip); - chip->bios_dir = tpm_bios_log_setup(dev_name(&chip->dev)); + rc = tpm_bios_log_setup(chip); - return 0; + return rc; } static void tpm1_chip_unregister(struct tpm_chip *chip) @@ -293,8 +295,7 @@ static void tpm1_chip_unregister(struct tpm_chip *chip) if (chip->flags & TPM_CHIP_FLAG_TPM2) return; - if (chip->bios_dir) - tpm_bios_log_teardown(chip->bios_dir); + tpm_bios_log_teardown(chip); } static void tpm_del_legacy_sysfs(struct tpm_chip *chip) |