tpm: Make use of TPM2_ALG_INVAL from enum

Now that the enum includes TPM2_ALG_INVAL, use that name in the
code.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Andrew Goodbody
2025-07-01 08:46:38 +03:00
committed by Ilias Apalodimas
parent 1fde88de16
commit 8280d2a77f
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -113,7 +113,7 @@ static int do_tpm2_pcr_extend(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
if (argc == 4) {
algo = tpm2_name_to_algorithm(argv[3]);
if (algo < 0)
if (algo == TPM2_ALG_INVAL)
return CMD_RET_FAILURE;
}
algo_len = tpm2_algorithm_to_len(algo);
@@ -157,7 +157,7 @@ static int do_tpm_pcr_read(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
if (argc == 4) {
algo = tpm2_name_to_algorithm(argv[3]);
if (algo < 0)
if (algo == TPM2_ALG_INVAL)
return CMD_RET_FAILURE;
}
algo_len = tpm2_algorithm_to_len(algo);
@@ -288,7 +288,7 @@ static int do_tpm2_pcrallocate(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
algo = tpm2_name_to_algorithm(argv[1]);
if (algo == -EINVAL)
if (algo == TPM2_ALG_INVAL)
return CMD_RET_USAGE;
ret = get_tpm(&dev);
+1 -1
View File
@@ -1141,7 +1141,7 @@ enum tpm2_algorithms tpm2_name_to_algorithm(const char *name)
}
printf("%s: unsupported algorithm %s\n", __func__, name);
return -EINVAL;
return TPM2_ALG_INVAL;
}
const char *tpm2_algorithm_name(enum tpm2_algorithms algo)