]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
soc: ti: k3-navss-ringacc: NULL check before dereference
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 12 Aug 2025 10:13:49 +0000 (11:13 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 19 Aug 2025 17:26:07 +0000 (11:26 -0600)
Move the first dereference of ring to after the NULL check has occurred.
This will prevent any possible dereference of NULL.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/soc/ti/k3-navss-ringacc.c

index 14114a65830f6af5fc2abdb891b084d1e04d79d2..ac29158d489020ab253a035dc76cf21bca3c2230 100644 (file)
@@ -632,12 +632,14 @@ err_free_ops:
 int k3_nav_ringacc_ring_cfg(struct k3_nav_ring *ring,
                            struct k3_nav_ring_cfg *cfg)
 {
-       struct k3_nav_ringacc *ringacc = ring->parent;
+       struct k3_nav_ringacc *ringacc;
        int ret = 0;
 
        if (!ring || !cfg)
                return -EINVAL;
 
+       ringacc = ring->parent;
+
        if (ringacc->dual_ring)
                return k3_dmaring_ring_cfg(ring, cfg);