Re: [PATCH v2] net: ethernet: ti: davinci_cpdma: fix warning "device driver frees DMA memory with different size"

From: David Miller
Date: Wed Dec 04 2019 - 15:37:22 EST


From: Grygorii Strashko <grygorii.strashko@xxxxxx>
Date: Wed, 4 Dec 2019 18:50:29 +0200

> @@ -1018,7 +1018,7 @@ static int cpdma_chan_submit_si(struct submit_info *si)
> struct cpdma_chan *chan = si->chan;
> struct cpdma_ctlr *ctlr = chan->ctlr;
> int len = si->len;
> - int swlen = len;
> + int swlen;
> struct cpdma_desc __iomem *desc;
> dma_addr_t buffer;
> u32 mode;
> @@ -1040,6 +1040,7 @@ static int cpdma_chan_submit_si(struct submit_info *si)
> chan->stats.runt_transmit_buff++;
> }
>
> + swlen = len;
> mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP;
> cpdma_desc_to_port(chan, mode, si->directed);
>
> --
> 2.17.1
>

Now there is no reason to keep a separate swlen variable.

The integral value is always consumed as the length before the descriptor bits
are added to it.

Therefore you can just use 'len' everywhere in this function now.