summaryrefslogtreecommitdiff
path: root/lib/tpm.c
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2016-01-21 23:19:13 +0100
committerSimon Glass <sjg@chromium.org>2016-01-28 21:01:22 -0700
commit0e37d4c2c631b0e94b7e891a5b37650d9bbd143c (patch)
treea956c2811e69307134194cb04da0d074d8fcea2a /lib/tpm.c
parent3faf2216d9649e2a22e6728194e9797cb46db933 (diff)
downloadu-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>
Diffstat (limited to 'lib/tpm.c')
-rw-r--r--lib/tpm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/tpm.c b/lib/tpm.c
index 8a62216..f428d45 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -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);
}