diff options
author | Grygorii Strashko <grygorii.strashko@ti.com> | 2020-07-24 23:39:40 +0200 |
---|---|---|
committer | Santosh Shilimkar <santosh.shilimkar@oracle.com> | 2020-07-24 23:39:40 +0200 |
commit | 80ff73f75848d3fdb9bc7b55b1dd9f2125243275 (patch) | |
tree | b3261c160918287aae7b5c68ba9ece27b8fef7a4 /drivers/soc | |
parent | dmaengine: ti: k3-udma: Switch to k3_ringacc_request_rings_pair (diff) | |
download | linux-80ff73f75848d3fdb9bc7b55b1dd9f2125243275.tar.xz linux-80ff73f75848d3fdb9bc7b55b1dd9f2125243275.zip |
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 <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Diffstat (limited to 'drivers/soc')
-rw-r--r-- | drivers/soc/ti/k3-ringacc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/soc/ti/k3-ringacc.c b/drivers/soc/ti/k3-ringacc.c index 8e459c64b593..1979479db58d 100644 --- a/drivers/soc/ti/k3-ringacc.c +++ b/drivers/soc/ti/k3-ringacc.c @@ -593,11 +593,13 @@ static int k3_ringacc_ring_cfg_sci(struct k3_ring *ring) int k3_ringacc_ring_cfg(struct k3_ring *ring, struct k3_ring_cfg *cfg) { - struct k3_ringacc *ringacc = ring->parent; + struct k3_ringacc *ringacc; int ret = 0; if (!ring || !cfg) return -EINVAL; + ringacc = ring->parent; + if (cfg->elm_size > K3_RINGACC_RING_ELSIZE_256 || cfg->mode >= K3_RINGACC_RING_MODE_INVALID || cfg->size & ~K3_RINGACC_CFG_RING_SIZE_ELCNT_MASK || |