From: Weizhao Ouyang Date: Mon, 4 Mar 2024 14:42:41 +0000 (+0000) Subject: driver: rng: Fix SMCCC TRNG crash X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=1da4d327d49bb068bdc69974e0dee1391dfb30e6;p=u-boot.git 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 --- 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 */