[PATCH 1/2] soc: ti: k3-navss-ringacc: NULL check before dereference
Andrew Goodbody
andrew.goodbody at linaro.org
Tue Aug 12 12:13:49 CEST 2025
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 at linaro.org>
---
drivers/soc/ti/k3-navss-ringacc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c
index 14114a65830..ac29158d489 100644
--- a/drivers/soc/ti/k3-navss-ringacc.c
+++ b/drivers/soc/ti/k3-navss-ringacc.c
@@ -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);
--
2.39.5
More information about the U-Boot
mailing list