diff mbox series

[v2,1/6] cmd: tpm-v1: fix compile error in TPMv1 list resources command

Message ID 20211111040631.21262-2-matt@traverse.com.au
State Accepted
Commit ebb6d74df3a33f8f65febfdf14f131197949cc46
Delegated to: Ilias Apalodimas
Headers show
Series drivers: tpm: Fix Atmel/Microchip TPMv1.2 issues | expand

Commit Message

Mathew McBride Nov. 11, 2021, 4:06 a.m. UTC
This command is not compiled by default and was not
updated to pass the udevice to tpm_get_capability.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 cmd/tpm-v1.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Simon Glass Nov. 25, 2021, 12:11 a.m. UTC | #1
On Wed, 10 Nov 2021 at 21:06, Mathew McBride <matt@traverse.com.au> wrote:
>
> This command is not compiled by default and was not
> updated to pass the udevice to tpm_get_capability.
>
> Signed-off-by: Mathew McBride <matt@traverse.com.au>
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  cmd/tpm-v1.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c
index 3a7e35d525..55f2aeff46 100644
--- a/cmd/tpm-v1.c
+++ b/cmd/tpm-v1.c
@@ -582,6 +582,7 @@  static int do_tpm_flush(struct cmd_tbl *cmdtp, int flag, int argc,
 static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
+	struct udevice *dev;
 	int type = 0;
 	u16 res_count;
 	u8 buf[288];
@@ -589,6 +590,10 @@  static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc,
 	int err;
 	uint i;
 
+	err = get_tpm(&dev);
+	if (err)
+		return err;
+
 	if (argc != 2)
 		return CMD_RET_USAGE;
 
@@ -619,7 +624,7 @@  static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc,
 	}
 
 	/* fetch list of already loaded resources in the TPM */
-	err = tpm_get_capability(TPM_CAP_HANDLE, type, buf,
+	err = tpm_get_capability(dev, TPM_CAP_HANDLE, type, buf,
 				 sizeof(buf));
 	if (err) {
 		printf("tpm_get_capability returned error %d.\n", err);