]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - lib/tpm.c
tpm: add missing va_end
[people/ms/u-boot.git] / lib / tpm.c
index cd7f88f2204e9119f0b24b6a7b98cdd1e441a193..d1cf5a8a1679fa7ab7f828c8b4290bb8aca80fe0 100644 (file)
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -95,8 +95,10 @@ int pack_byte_string(uint8_t *str, size_t size, const char *format, ...)
                        return -1;
                }
 
-               if (offset + length > size)
+               if (offset + length > size) {
+                       va_end(args);
                        return -1;
+               }
 
                switch (*format) {
                case 'b':
@@ -163,6 +165,7 @@ int unpack_byte_string(const uint8_t *str, size_t size, const char *format, ...)
                        length = va_arg(args, uint32_t);
                        break;
                default:
+                       va_end(args);
                        debug("Couldn't recognize format string\n");
                        return -1;
                }
@@ -230,10 +233,9 @@ static uint32_t tpm_sendrecv_command(const void *command,
                void *response, size_t *size_ptr)
 {
        struct udevice *dev;
-       int ret;
+       int err, ret;
        uint8_t response_buffer[COMMAND_BUFFER_SIZE];
        size_t response_length;
-       uint32_t err;
 
        if (response) {
                response_length = *size_ptr;