From 1da4d327d49bb068bdc69974e0dee1391dfb30e6 Mon Sep 17 00:00:00 2001 From: Weizhao Ouyang Date: Mon, 4 Mar 2024 14:42:41 +0000 Subject: [PATCH] driver: rng: Fix SMCCC TRNG crash Fix a SMCCC TRNG null pointer crash due to a failed smccc feature binding. Fixes: 53355bb86c25 ("drivers: rng: add smccc trng driver") Reviewed-by: Heinrich Schuchardt Signed-off-by: Weizhao Ouyang --- drivers/rng/smccc_trng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rng/smccc_trng.c b/drivers/rng/smccc_trng.c index 5bb7ebe8a4..f59b80666b 100644 --- a/drivers/rng/smccc_trng.c +++ b/drivers/rng/smccc_trng.c @@ -165,7 +165,7 @@ static int smccc_trng_probe(struct udevice *dev) struct smccc_trng_priv *priv = dev_get_priv(dev); struct arm_smccc_res res; - if (!(smccc_trng_is_supported(smccc->invoke_fn))) + if (!smccc || !(smccc_trng_is_supported(smccc->invoke_fn))) return -ENODEV; /* At least one of 64bit and 32bit interfaces is available */ -- 2.39.5