[PATCH v2 0/2] tpm: Attempt to return value not in enum

Andrew Goodbody andrew.goodbody at linaro.org
Fri Jun 27 11:37:25 CEST 2025


The function tpm2_name_to_algorithm attempts to return -EINVAL
for an error but that is not included in the enum tpm2_algorithms
which is defined as the return type for this function.
Add -EINVAL as TPM2_ALG_INVAL to the enum so that it can be
returned as desired. Update the code to use this enum value.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
Changes in v2:
- Add patch to make use of new enum value TPM2_ALG_INVAL
- Link to v1: https://lore.kernel.org/r/20250625-tpm_enum-v1-1-73a1aff0bd4c@linaro.org

---
Andrew Goodbody (2):
      cmd: tpm: Fix attempt to return value not in enum
      tpm: Make use of TPM2_ALG_INVAL from enum

 cmd/tpm-v1.c                 | 1 +
 cmd/tpm-v2.c                 | 6 +++---
 cmd/tpm_test.c               | 1 +
 drivers/tpm/sandbox_common.c | 1 +
 include/tpm-v2.h             | 1 +
 lib/tpm-v2.c                 | 2 +-
 6 files changed, 8 insertions(+), 4 deletions(-)
---
base-commit: 903eb123236ccbd8ef05d43507a2a910b785bd56
change-id: 20250625-tpm_enum-098ee9a5eb6b

Best regards,
-- 
Andrew Goodbody <andrew.goodbody at linaro.org>



More information about the U-Boot mailing list