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>
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 @@
 	struct udevice *dev;
 
 	err = uclass_first_device(UCLASS_TPM, &dev);
-	if (err)
+	if (err || !dev)
 		return err;
 	return tpm_open(dev);
 }