Browse Source

tpm: Fix fault in case CONFIG_DM_TPM is set without any TPM

In case CONFIG_DM_TPM was set without any TPM chipset configured a fault
was generated (NULL pointer access).

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
scm-imx_v2016.03_4.1.15_2.0.0_ga
Christophe Ricard 5 years ago
committed by Simon Glass
parent
commit
0e37d4c2c6
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      cmd/tpm.c
  2. +1
    -1
      lib/tpm.c

+ 1
- 1
cmd/tpm.c View File

@ -448,7 +448,7 @@ static int get_tpm(struct udevice **devp)
int rc;
rc = uclass_first_device(UCLASS_TPM, devp);
if (rc) {
if (rc || !*devp) {
printf("Could not find TPM (ret=%d)\n", rc);
return CMD_RET_FAILURE;
}


+ 1
- 1
lib/tpm.c View File

@ -262,7 +262,7 @@ int tpm_init(void)
struct udevice *dev;
err = uclass_first_device(UCLASS_TPM, &dev);
if (err)
if (err || !dev)
return err;
return tpm_open(dev);
}


Loading…
Cancel
Save