From: Andrew Goodbody Date: Mon, 30 Jun 2025 10:23:39 +0000 (+0100) Subject: cmd: tpm: Fix attempt to return value not in enum X-Git-Tag: v2025.10-rc1~134^2~8^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fde88de1609a046285675ab76e8ecd3e7792b2b;p=pandora-u-boot.git cmd: tpm: Fix attempt to return value not in enum The function tpm2_name_to_algorithm is defined as returning an enum for the algorithm specified but it also attempts to return an error on failure, but that error is not included in the enum. Add the error to the enum so that it can be returned. This issue was reported by Smatch. Signed-off-by: Andrew Goodbody Reviewed-by: Ilias Apalodimas Signed-off-by: Ilias Apalodimas --- diff --git a/include/tpm-v2.h b/include/tpm-v2.h index ece422df0c7..f3eb2ef5643 100644 --- a/include/tpm-v2.h +++ b/include/tpm-v2.h @@ -20,6 +20,7 @@ #define __TPM_V2_H #include +#include struct udevice; @@ -266,6 +267,7 @@ enum tpm2_return_codes { * TPM2 algorithms. */ enum tpm2_algorithms { + TPM2_ALG_INVAL = -EINVAL, TPM2_ALG_SHA1 = 0x04, TPM2_ALG_XOR = 0x0A, TPM2_ALG_SHA256 = 0x0B,