Skip to content

Commit 80ff73f

Browse files
grygoriySSantoshShilimkar
authored andcommitted
soc: ti: k3-ringacc: fix: warn: variable dereferenced before check 'ring'
Fix build warning in k3_ringacc_ring_cfg(): smatch warnings: drivers/soc/ti/k3-ringacc.c:562 k3_ringacc_ring_cfg() warn: variable dereferenced before check 'ring' (see line 559) 557 int k3_ringacc_ring_cfg(struct k3_ring *ring, struct k3_ring_cfg *cfg) 558 { @559 struct k3_ringacc *ringacc = ring->parent; ^^^^^^^^^^^^ Dereference. 560 int ret = 0; 561 @562 if (!ring || !cfg) ^^^^ Check too late. Delete it? Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Grygorii Strashko <[email protected]> Signed-off-by: Santosh Shilimkar <[email protected]>
1 parent 4927b1a commit 80ff73f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/soc/ti/k3-ringacc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,11 +593,13 @@ static int k3_ringacc_ring_cfg_sci(struct k3_ring *ring)
593593

594594
int k3_ringacc_ring_cfg(struct k3_ring *ring, struct k3_ring_cfg *cfg)
595595
{
596-
struct k3_ringacc *ringacc = ring->parent;
596+
struct k3_ringacc *ringacc;
597597
int ret = 0;
598598

599599
if (!ring || !cfg)
600600
return -EINVAL;
601+
ringacc = ring->parent;
602+
601603
if (cfg->elm_size > K3_RINGACC_RING_ELSIZE_256 ||
602604
cfg->mode >= K3_RINGACC_RING_MODE_INVALID ||
603605
cfg->size & ~K3_RINGACC_CFG_RING_SIZE_ELCNT_MASK ||

0 commit comments

Comments
 (0)