diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2016-01-21 23:19:13 +0100 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-01-28 21:01:22 -0700 |
commit | 0e37d4c2c631b0e94b7e891a5b37650d9bbd143c (patch) | |
tree | a956c2811e69307134194cb04da0d074d8fcea2a | |
parent | 3faf2216d9649e2a22e6728194e9797cb46db933 (diff) | |
download | u-boot-imx-0e37d4c2c631b0e94b7e891a5b37650d9bbd143c.zip u-boot-imx-0e37d4c2c631b0e94b7e891a5b37650d9bbd143c.tar.gz u-boot-imx-0e37d4c2c631b0e94b7e891a5b37650d9bbd143c.tar.bz2 |
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>
-rw-r--r-- | cmd/tpm.c | 2 | ||||
-rw-r--r-- | lib/tpm.c | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -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; } @@ -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); } |