On 2/24/22 19:05, Sughosh Ganu wrote:
The tpm_startup function returns negative values for error
conditions. Fix the return type of the function to a signed int
instead of a u32.

Signed-off-by: Sughosh Ganu <sughosh.g...@linaro.org>
---
  include/tpm_api.h | 2 +-
  lib/tpm_api.c     | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/tpm_api.h b/include/tpm_api.h
index b9e3e8b5e6..fb6ee14e23 100644
--- a/include/tpm_api.h
+++ b/include/tpm_api.h
@@ -18,7 +18,7 @@
   * @param mode                TPM startup mode
   * Return: return code of the operation

Should this become:

Return: 0 for success, -ve in case of error ?

If we would stop at after this patch, TPM errors would be returned as
-EPERM (= TPM_LIB_ERROR). So maybe this patch should be merged with a
later patch.

Best regards

Heinrich

   */
-u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode);
+int tpm_startup(struct udevice *dev, enum tpm_startup_type mode);

  /**
   * Issue a TPM_SelfTestFull command.
diff --git a/lib/tpm_api.c b/lib/tpm_api.c
index 1bbe33a3fc..b762202866 100644
--- a/lib/tpm_api.c
+++ b/lib/tpm_api.c
@@ -21,7 +21,7 @@ static bool is_tpm2(struct udevice *dev)
        return IS_ENABLED(CONFIG_TPM_V2) && tpm_get_version(dev) == TPM_V2;
  }

-u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode)
+int tpm_startup(struct udevice *dev, enum tpm_startup_type mode)
  {
        if (is_tpm1(dev)) {
                return tpm1_startup(dev, mode);

Reply via email to