re: DMA: AT91: Get residual bytes in dma buffer

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

 



Hello Elen Song,

The patch d48de6f1a81b: "DMA: AT91: Get residual bytes in dma buffer"
from May 10, 2013, leads to the following static checker warning:

	drivers/dma/at_hdmac.c:299 atc_get_bytes_left()
	warn: unsigned 'atchan->remain_desc' is never less than zero.

drivers/dma/at_hdmac.c
   289          if (unlikely(test_bit(ATC_IS_BTC, &atchan->status))) {
   290                  clear_bit(ATC_IS_BTC, &atchan->status);
   291                  desc_cur = atc_get_current_descriptors(atchan,
   292                                                  channel_readl(atchan, DSCR));
   293                  if (!desc_cur) {
   294                          ret = -EINVAL;
   295                          goto out;
   296                  }
   297                  atchan->remain_desc -= (desc_cur->lli.ctrla & ATC_BTSIZE_MAX)
   298                                                  << (desc_first->tx_width);
   299                  if (atchan->remain_desc < 0) {
   300                          ret = -EINVAL;
   301                          goto out;

We never hit this "goto out" because atchan->remain_desc is a u32.

   302                  } else {
   303                          ret = atchan->remain_desc;
   304                  }
   305          } else {
   306                  /*
   307                   * Get residual bytes when current
   308                   * descriptor transfer in progress.
   309                   */
   310                  count = (channel_readl(atchan, CTRLA) & ATC_BTSIZE_MAX)
   311                                  << (desc_first->tx_width);
   312                  ret = atchan->remain_desc - count;
   313          }
   314          /*
   315           * Check fifo empty.
   316           */
   317          if (!(dma_readl(atdma, CHSR) & AT_DMA_EMPT(chan_id)))
   318                  atc_issue_pending(chan);
   319  
   320  out:
   321          return ret;
   322  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux