tpm: report driver error code to upper layer
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 15 May 2018 09:57:11 +0000 (11:57 +0200)
committerTom Rini <trini@konsulko.com>
Sat, 26 May 2018 00:12:56 +0000 (20:12 -0400)
Instead of returning a generic 'library' error, report back the actual
error code so it can be displayed to the user by the regular error path.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
lib/tpm-common.c

index 33fa85926c30e83771221c02c82ae934e2475ff3..43b530865a0c4e7c01d32d66f5f43fe1702afe83 100644 (file)
@@ -169,7 +169,8 @@ u32 tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr)
                       response, &response_length);
 
        if (err < 0)
-               return TPM_LIB_ERROR;
+               return err;
+
        if (size_ptr)
                *size_ptr = response_length;