From b90927bd0d81096239ff4a48a71c3d9e87ef7209 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Tue, 12 Aug 2025 11:13:49 +0100 Subject: [PATCH 1/2] soc: ti: k3-navss-ringacc: NULL check before dereference 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 --- 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); From 13ca68b104ea75d54e86816ba6d86ef5e70a2668 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Tue, 12 Aug 2025 11:13:50 +0100 Subject: [PATCH 2/2] soc: ti: k3-navss-ringacc: Do not use uninitialised variable In k3_nav_ringacc_probe_dt there can be no error code returned from dev_read_u32_default so ret is not assigned to and should not be used. Remove the use of ret from the dev_err call as it is unitialised. This issue was found by Smatch. Signed-off-by: Andrew Goodbody --- drivers/soc/ti/k3-navss-ringacc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c index ac29158d489..d37c454143b 100644 --- a/drivers/soc/ti/k3-navss-ringacc.c +++ b/drivers/soc/ti/k3-navss-ringacc.c @@ -932,7 +932,7 @@ static int k3_nav_ringacc_probe_dt(struct k3_nav_ringacc *ringacc) ringacc->num_rings = dev_read_u32_default(dev, "ti,num-rings", 0); if (!ringacc->num_rings) { - dev_err(dev, "ti,num-rings read failure %d\n", ret); + dev_err(dev, "ti,num-rings read failure\n"); return -EINVAL; }