Hi Serge,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.15-rc2]
[cannot apply to ntb/ntb-next next-20171205]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Serge-Semin/NTB-Add-full-multi-port-API-support-to-the-test-drivers/20171206-081300
config: x86_64-randconfig-x004-201749 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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/ntb/test/ntb_perf.c: In function 'perf_thread_work':
>> drivers/ntb/test/ntb_perf.c:821:22: warning: 'try' may be used uninitialized 
>> in this function [-Wmaybe-uninitialized]
     } while (!tx && (try++ < DMA_TRIES));
                      ~~~^~
   drivers/ntb/test/ntb_perf.c:782:6: note: 'try' was declared here
     int try, ret = 0;
         ^~~

vim +/try +821 drivers/ntb/test/ntb_perf.c

   775  
   776  static int perf_copy_chunk(struct perf_thread *pthr,
   777                             void __iomem *dst, void *src, size_t len)
   778  {
   779          struct dma_async_tx_descriptor *tx;
   780          struct dmaengine_unmap_data *unmap;
   781          struct device *dma_dev;
   782          int try, ret = 0;
   783  
   784          if (!use_dma) {
   785                  memcpy_toio(dst, src, len);
   786                  goto ret_check_tsync;
   787          }
   788  
   789          dma_dev = pthr->dma_chan->device->dev;
   790  
   791          if (!is_dma_copy_aligned(pthr->dma_chan->device, 
offset_in_page(src),
   792                                   offset_in_page(dst), len))
   793                  return -EIO;
   794  
   795          unmap = dmaengine_get_unmap_data(dma_dev, 2, GFP_NOWAIT);
   796          if (!unmap)
   797                  return -ENOMEM;
   798  
   799          unmap->len = len;
   800          unmap->addr[0] = dma_map_page(dma_dev, virt_to_page(src),
   801                  offset_in_page(src), len, DMA_TO_DEVICE);
   802          if (dma_mapping_error(dma_dev, unmap->addr[0])) {
   803                  ret = -EIO;
   804                  goto err_free_resource;
   805          }
   806          unmap->to_cnt = 1;
   807  
   808          unmap->addr[1] = dma_map_page(dma_dev, virt_to_page(dst),
   809                  offset_in_page(dst), len, DMA_FROM_DEVICE);
   810          if (dma_mapping_error(dma_dev, unmap->addr[1])) {
   811                  ret = -EIO;
   812                  goto err_free_resource;
   813          }
   814          unmap->from_cnt = 1;
   815  
   816          do {
   817                  tx = dmaengine_prep_dma_memcpy(pthr->dma_chan, 
unmap->addr[1],
   818                          unmap->addr[0], len, DMA_PREP_INTERRUPT | 
DMA_CTRL_ACK);
   819                  if (!tx)
   820                          msleep(DMA_MDELAY);
 > 821          } while (!tx && (try++ < DMA_TRIES));
   822  
   823          if (!tx) {
   824                  ret = -EIO;
   825                  goto err_free_resource;
   826          }
   827  
   828          tx->callback = perf_dma_copy_callback;
   829          tx->callback_param = pthr;
   830          dma_set_unmap(tx, unmap);
   831  
   832          if (dma_submit_error(dmaengine_submit(tx))) {
   833                  dmaengine_unmap_put(unmap);
   834                  goto err_free_resource;
   835          }
   836  
   837          dmaengine_unmap_put(unmap);
   838  
   839          atomic_inc(&pthr->dma_sync);
   840          dma_async_issue_pending(pthr->dma_chan);
   841  
   842  ret_check_tsync:
   843          return likely(atomic_read(&pthr->perf->tsync) > 0) ? 0 : -EINTR;
   844  
   845  err_free_resource:
   846          dmaengine_unmap_put(unmap);
   847  
   848          return ret;
   849  }
   850  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to