aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm-chip.c
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-11-14 05:00:50 -0500
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-11-28 01:31:31 +0200
commitcd9b7631a888f6615dac148c10d72a253b98c64b (patch)
treefea727e138e62c981c51158e450f0df4612223ea /drivers/char/tpm/tpm-chip.c
parentb1a9b7b602c5320ab3827a3f6a6a5211826308c4 (diff)
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.c9
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)

Privacy Policy