k3dma: tighten range checking a bit
Subsystems (2)
PATCH 2/2 k3dma: tighten range checking a bit
My static checker complains that it's possible for "num" to be negative. I haven't investigated this completely, but it's more natural to make the type unsigned and that makes the static checker happy.
Signed-off-by Dan Carpenter <[email protected]>
---
Hm... I probably should investigate this a bit more because the same code is copy and pasted all over the place.
drivers/dma/k3dma.c +3 -3
@@ -440,7 +440,7 @@ static void k3_dma_fill_desc(struct k3_dma_desc_sw *ds, dma_addr_t dst, ds->desc_hw[num].config = ccfg; } -static struct k3_dma_desc_sw *k3_dma_alloc_desc_resource (int num, +static struct k3_dma_desc_sw *k3_dma_alloc_desc_resource (size_t num,struct dma_chan *chan) {struct k3_dma_chan *c =to_k3_chan (chan);
@@ -449,7 +449,7 @@ static struct k3_dma_desc_sw *k3_dma_alloc_desc_resource(int num,int lli_limit =LLI_BLOCK_SIZE /sizeof (struct k3_desc_hw );if (num > lli_limit) { -dev_dbg (chan->device->dev,"vch %p: sg num %d exceed max %d\n" , +dev_dbg (chan->device->dev,"vch %p: sg num %lu exceed max %d\n" , &c->vc, num, lli_limit);return NULL ; }
@@ -476,7 +476,7 @@ static struct dma_async_tx_descriptor *k3_dma_prep_memcpy(struct k3_dma_chan *c =to_k3_chan (chan);struct k3_dma_desc_sw *ds;size_t copy =0 ; -int num =0 ; +size_t num =0 ;if (!len)return NULL ;