[bug report] staging: mt7621-dma: ralink: add rt2880 dma engine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello NeilBrown,

The patch 0853c7a53eb3: "staging: mt7621-dma: ralink: add rt2880 dma
engine" from Mar 15, 2018, leads to the following static checker
warning:

	drivers/staging/mt7621-dma/mtk-hsdma.c:344 mtk_hsdma_start_transfer()
	error: potentially dereferencing uninitialized 'tx_desc'.

drivers/staging/mt7621-dma/mtk-hsdma.c
   321  static int mtk_hsdma_start_transfer(struct mtk_hsdam_engine *hsdma,
   322                                      struct mtk_hsdma_chan *chan)
   323  {
   324          dma_addr_t src, dst;
   325          size_t len, tlen;
   326          struct hsdma_desc *tx_desc, *rx_desc;
                                   ^^^^^^^
   327          struct mtk_hsdma_sg *sg;
   328          unsigned int i;
   329          int rx_idx;
   330  
   331          sg = &chan->desc->sg[0];
   332          len = sg->len;
   333          chan->desc->num_sgs = DIV_ROUND_UP(len, HSDMA_MAX_PLEN);
   334  
   335          /* tx desc */
   336          src = sg->src_addr;
   337          for (i = 0; i < chan->desc->num_sgs; i++) {
   338                  if (len > HSDMA_MAX_PLEN)
   339                          tlen = HSDMA_MAX_PLEN;
   340                  else
   341                          tlen = len;
   342  
   343                  if (i & 0x1) {
   344                          tx_desc->addr1 = src;
                                ^^^^^^^^^^^^^^

   345                          tx_desc->flags |= HSDMA_DESC_PLEN1(tlen);
   346                  } else {
   347                          tx_desc = &chan->tx_ring[chan->tx_idx];
   348                          tx_desc->addr0 = src;
   349                          tx_desc->flags = HSDMA_DESC_PLEN0(tlen);
   350  
   351                          /* update index */
   352                          chan->tx_idx = HSDMA_NEXT_DESC(chan->tx_idx);
   353                  }
   354  
   355                  src += tlen;
   356                  len -= tlen;
   357          }
   358          if (i & 0x1)
   359                  tx_desc->flags |= HSDMA_DESC_LS0;
                        ^^^^^^^^^^^^^^
Never initialized.

   360          else
   361                  tx_desc->flags |= HSDMA_DESC_LS1;
   362  
   363          /* rx desc */
   364          rx_idx = HSDMA_NEXT_DESC(chan->rx_idx);
   365          len = sg->len;

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux