提交 0e37d4c2 编写于 作者: C Christophe Ricard 提交者: Simon Glass

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: NSimon Glass <sjg@chromium.org>
Signed-off-by: NChristophe Ricard <christophe-h.ricard@st.com>
上级 3faf2216
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册