Re: [PATCH] scatterlist: Speed up for_each_sg() loop macro

kbuild test robot
2019-10-28T23:47:33Z

[-- Attachment #1: Type: text/plain, Size: 5491 bytes --]

Hi Sultan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.4-rc5 next-20191028]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Sultan-Alsawaf/scatterlist-Speed-up-for_each_sg-loop-macro/20191029-045656
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8005803a2ca0af49f36f6e9329b5ecda3df27347
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

drivers/dma/st_fdma.c: In function 'st_fdma_prep_slave_sg':
>> drivers/dma/st_fdma.c:549:19: warning: 'hw_node' may be used uninitialized in this function [-Wmaybe-uninitialized]
hw_node->control |= FDMA_NODE_CTRL_INT_EON;
^~

vim +/hw_node +549 drivers/dma/st_fdma.c

6b4cd727eaf15e Peter Griffin 2016-10-18 504
6b4cd727eaf15e Peter Griffin 2016-10-18 505 static struct dma_async_tx_descriptor *st_fdma_prep_slave_sg(
6b4cd727eaf15e Peter Griffin 2016-10-18 506 struct dma_chan *chan, struct scatterlist *sgl,
6b4cd727eaf15e Peter Griffin 2016-10-18 507 unsigned int sg_len, enum dma_transfer_direction direction,
6b4cd727eaf15e Peter Griffin 2016-10-18 508 unsigned long flags, void *context)
6b4cd727eaf15e Peter Griffin 2016-10-18 509 {
6b4cd727eaf15e Peter Griffin 2016-10-18 510 struct st_fdma_chan *fchan;
6b4cd727eaf15e Peter Griffin 2016-10-18 511 struct st_fdma_desc *fdesc;
6b4cd727eaf15e Peter Griffin 2016-10-18 512 struct st_fdma_hw_node *hw_node;
6b4cd727eaf15e Peter Griffin 2016-10-18 513 struct scatterlist *sg;
6b4cd727eaf15e Peter Griffin 2016-10-18 514 int i;
6b4cd727eaf15e Peter Griffin 2016-10-18 515
6b4cd727eaf15e Peter Griffin 2016-10-18 516 fchan = st_fdma_prep_common(chan, sg_len, direction);
6b4cd727eaf15e Peter Griffin 2016-10-18 517 if (!fchan)
6b4cd727eaf15e Peter Griffin 2016-10-18 518 return NULL;
6b4cd727eaf15e Peter Griffin 2016-10-18 519
6b4cd727eaf15e Peter Griffin 2016-10-18 520 if (!sgl)
6b4cd727eaf15e Peter Griffin 2016-10-18 521 return NULL;
6b4cd727eaf15e Peter Griffin 2016-10-18 522
6b4cd727eaf15e Peter Griffin 2016-10-18 523 fdesc = st_fdma_alloc_desc(fchan, sg_len);
6b4cd727eaf15e Peter Griffin 2016-10-18 524 if (!fdesc) {
6b4cd727eaf15e Peter Griffin 2016-10-18 525 dev_err(fchan->fdev->dev, "no memory for desc\n");
6b4cd727eaf15e Peter Griffin 2016-10-18 526 return NULL;
6b4cd727eaf15e Peter Griffin 2016-10-18 527 }
6b4cd727eaf15e Peter Griffin 2016-10-18 528
6b4cd727eaf15e Peter Griffin 2016-10-18 529 fdesc->iscyclic = false;
6b4cd727eaf15e Peter Griffin 2016-10-18 530
6b4cd727eaf15e Peter Griffin 2016-10-18 531 for_each_sg(sgl, sg, sg_len, i) {
6b4cd727eaf15e Peter Griffin 2016-10-18 532 hw_node = fdesc->node[i].desc;
6b4cd727eaf15e Peter Griffin 2016-10-18 533
6b4cd727eaf15e Peter Griffin 2016-10-18 534 hw_node->next = fdesc->node[(i + 1) % sg_len].pdesc;
6b4cd727eaf15e Peter Griffin 2016-10-18 535 hw_node->control = FDMA_NODE_CTRL_REQ_MAP_DREQ(fchan->dreq_line);
6b4cd727eaf15e Peter Griffin 2016-10-18 536
6b4cd727eaf15e Peter Griffin 2016-10-18 537 fill_hw_node(hw_node, fchan, direction);
6b4cd727eaf15e Peter Griffin 2016-10-18 538
6b4cd727eaf15e Peter Griffin 2016-10-18 539 if (direction == DMA_MEM_TO_DEV)
6b4cd727eaf15e Peter Griffin 2016-10-18 540 hw_node->saddr = sg_dma_address(sg);
6b4cd727eaf15e Peter Griffin 2016-10-18 541 else
6b4cd727eaf15e Peter Griffin 2016-10-18 542 hw_node->daddr = sg_dma_address(sg);
6b4cd727eaf15e Peter Griffin 2016-10-18 543
6b4cd727eaf15e Peter Griffin 2016-10-18 544 hw_node->nbytes = sg_dma_len(sg);
6b4cd727eaf15e Peter Griffin 2016-10-18 545 hw_node->generic.length = sg_dma_len(sg);
6b4cd727eaf15e Peter Griffin 2016-10-18 546 }
6b4cd727eaf15e Peter Griffin 2016-10-18 547
6b4cd727eaf15e Peter Griffin 2016-10-18 548 /* interrupt at end of last node */
6b4cd727eaf15e Peter Griffin 2016-10-18 @549 hw_node->control |= FDMA_NODE_CTRL_INT_EON;
6b4cd727eaf15e Peter Griffin 2016-10-18 550
6b4cd727eaf15e Peter Griffin 2016-10-18 551 return vchan_tx_prep(&fchan->vchan, &fdesc->vdesc, flags);
6b4cd727eaf15e Peter Griffin 2016-10-18 552 }
6b4cd727eaf15e Peter Griffin 2016-10-18 553

:::::: The code at line 549 was first introduced by commit
:::::: 6b4cd727eaf15ed225b9a3a96ec1d64761ee728a dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support

:::::: TO: Peter Griffin <peter.griffin@linaro.org>
:::::: CC: Vinod Koul <vinod.koul@intel.com>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 71975 bytes --]