]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
driver: rng: Fix SMCCC TRNG crash
authorWeizhao Ouyang <o451686892@gmail.com>
Mon, 4 Mar 2024 14:42:41 +0000 (14:42 +0000)
committerTom Rini <trini@konsulko.com>
Wed, 13 Mar 2024 16:40:43 +0000 (12:40 -0400)
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 <xypron.glpk@gmx.de>
Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
drivers/rng/smccc_trng.c

index 5bb7ebe8a497620b99e521dea30cbea0548f99c7..f59b80666b330a4ee182887dafb256f9b2feb962 100644 (file)
@@ -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 */