[PATCH v3 7/7] tpm: open code tpm2_create_null_primary()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As tpm2_sessions_init() has been shrunk only as a single and only call
site for tpm2_create_null_primary(), open code it to the call site.

Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
---
v3:
- A new patch.
---
 drivers/char/tpm/tpm2-sessions.c | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/drivers/char/tpm/tpm2-sessions.c b/drivers/char/tpm/tpm2-sessions.c
index d240039d0849..72c83eb3f665 100644
--- a/drivers/char/tpm/tpm2-sessions.c
+++ b/drivers/char/tpm/tpm2-sessions.c
@@ -1281,7 +1281,13 @@ static int tpm2_create_primary(struct tpm_chip *chip, u32 hierarchy,
 	return rc;
 }
 
-static int tpm2_create_null_primary(struct tpm_chip *chip)
+/**
+ * tpm2_sessions_init() - Initialize the null keypair for authenticated sessions
+ * @chip: a &tpm_chip instance
+ *
+ * Return: 0 on success and -ENODEV on failure.
+ */
+int tpm2_sessions_init(struct tpm_chip *chip)
 {
 	u32 null_key;
 	int rc;
@@ -1308,23 +1314,5 @@ static int tpm2_create_null_primary(struct tpm_chip *chip)
 	/* Map all errors to -ENODEV: */
 	return rc ? -ENODEV : rc;
 }
-
-/**
- * tpm2_sessions_init() - start of day initialization for the sessions code
- * @chip: TPM chip
- *
- * Derive and context save the null primary and allocate memory in the
- * struct tpm_chip for the authorizations.
- */
-int tpm2_sessions_init(struct tpm_chip *chip)
-{
-	int rc;
-
-	rc = tpm2_create_null_primary(chip);
-	if (rc)
-		return rc;
-
-	return rc;
-}
 EXPORT_SYMBOL(tpm2_sessions_init);
 #endif /* CONFIG_TCG_TPM2_HMAC */
-- 
2.46.0





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux