Hi Joerg,

I love your patch! Perhaps something to improve:

[auto build test WARNING on swiotlb/linux-next]
[also build test WARNING on v5.0-rc4]
[cannot apply to next-20190201]
[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/Joerg-Roedel/swiotlb-Return-error-from-swiotlb_init_with_tbl/20190203-013129
base:   https://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb.git 
linux-next
config: riscv-tinyconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 8.2.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=8.2.0 make.cross ARCH=riscv 

All warnings (new ones prefixed by >>):

   kernel/dma/swiotlb.c: In function 'swiotlb_init_with_tbl':
>> kernel/dma/swiotlb.c:230:17: warning: passing argument 1 of 'memblock_free' 
>> makes integer from pointer without a cast [-Wint-conversion]
      memblock_free(io_tlb_list,
                    ^~~~~~~~~~~
   In file included from kernel/dma/swiotlb.c:42:
   include/linux/memblock.h:123:31: note: expected 'phys_addr_t' {aka 'long 
long unsigned int'} but argument is of type 'unsigned int *'
    int memblock_free(phys_addr_t base, phys_addr_t size);
                      ~~~~~~~~~~~~^~~~
   kernel/dma/swiotlb.c:234:17: warning: passing argument 1 of 'memblock_free' 
makes integer from pointer without a cast [-Wint-conversion]
      memblock_free(io_tlb_orig_addr,
                    ^~~~~~~~~~~~~~~~
   In file included from kernel/dma/swiotlb.c:42:
   include/linux/memblock.h:123:31: note: expected 'phys_addr_t' {aka 'long 
long unsigned int'} but argument is of type 'phys_addr_t *' {aka 'long long 
unsigned int *'}
    int memblock_free(phys_addr_t base, phys_addr_t size);
                      ~~~~~~~~~~~~^~~~

vim +/memblock_free +230 kernel/dma/swiotlb.c

   190  
   191  int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int 
verbose)
   192  {
   193          unsigned long i, bytes;
   194  
   195          bytes = nslabs << IO_TLB_SHIFT;
   196  
   197          io_tlb_nslabs = nslabs;
   198          io_tlb_start = __pa(tlb);
   199          io_tlb_end = io_tlb_start + bytes;
   200  
   201          /*
   202           * Allocate and initialize the free list array.  This array is 
used
   203           * to find contiguous free memory regions of size up to 
IO_TLB_SEGSIZE
   204           * between io_tlb_start and io_tlb_end.
   205           */
   206          io_tlb_list = memblock_alloc_nopanic(
   207                                  PAGE_ALIGN(io_tlb_nslabs * sizeof(int)),
   208                                  PAGE_SIZE);
   209          io_tlb_orig_addr = memblock_alloc_nopanic(
   210                                  PAGE_ALIGN(io_tlb_nslabs * 
sizeof(phys_addr_t)),
   211                                  PAGE_SIZE);
   212          if (io_tlb_list == NULL || io_tlb_orig_addr == NULL)
   213                  goto out_fail;
   214  
   215          for (i = 0; i < io_tlb_nslabs; i++) {
   216                  io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, 
IO_TLB_SEGSIZE);
   217                  io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
   218          }
   219          io_tlb_index = 0;
   220  
   221          if (verbose)
   222                  swiotlb_print_info();
   223  
   224          swiotlb_set_max_segment(io_tlb_nslabs << IO_TLB_SHIFT);
   225  
   226          return 0;
   227  
   228  out_fail:
   229          if (io_tlb_list)
 > 230                  memblock_free(io_tlb_list,
   231                                PAGE_ALIGN(io_tlb_nslabs * sizeof(int)));
   232  
   233          if (io_tlb_orig_addr)
   234                  memblock_free(io_tlb_orig_addr,
   235                                PAGE_ALIGN(io_tlb_nslabs * 
sizeof(phys_addr_t)));
   236  
   237          io_tlb_list      = NULL;
   238          io_tlb_orig_addr = NULL;
   239          io_tlb_end       = 0;
   240          io_tlb_start     = 0;
   241          io_tlb_nslabs    = 0;
   242          max_segment      = 0;
   243  
   244          return -ENOMEM;
   245  }
   246  

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to