tree:
git://git.infradead.org/users/hch/misc.git dma_alloc_pages
head: ebfa77e612f8650cb120011030b7a9e951ebee56
commit: ebfa77e612f8650cb120011030b7a9e951ebee56 [17/17] dma-mapping: replace
DMA_ATTR_NON_CONSISTENT with dma_{alloc,free}_pages
config: powerpc-randconfig-r021-20200817 (attached as .config)
compiler: clang version 12.0.0 (
https://github.com/llvm/llvm-project
de71b46a519db014ce906a39f8a0e1b235ef1568)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
git checkout ebfa77e612f8650cb120011030b7a9e951ebee56
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
> kernel/dma/mapping.c:512:9: error: implicit declaration of
function 'dma_alloc_contiguous' [-Werror,-Wimplicit-function-declaration]
page = dma_alloc_contiguous(dev, size, gfp | __GFP_ZERO);
^
> kernel/dma/mapping.c:512:7: warning: incompatible integer to
pointer conversion assigning to 'struct page *' from 'int'
[-Wint-conversion]
page = dma_alloc_contiguous(dev, size, gfp |
__GFP_ZERO);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> kernel/dma/mapping.c:518:3: error: implicit declaration of
function 'dma_free_contiguous' [-Werror,-Wimplicit-function-declaration]
dma_free_contiguous(dev, page, size);
^
kernel/dma/mapping.c:518:3: note: did you mean 'dma_alloc_contiguous'?
kernel/dma/mapping.c:512:9: note: 'dma_alloc_contiguous' declared here
page = dma_alloc_contiguous(dev, size, gfp | __GFP_ZERO);
^
> kernel/dma/mapping.c:540:11: warning: variable 'vaddr' is
used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if (ops->alloc_pages)
^~~~~~~~~~~~~~~~
kernel/dma/mapping.c:545:9: note: uninitialized use occurs here
return vaddr;
^~~~~
kernel/dma/mapping.c:540:7: note: remove the 'if' if its condition is always
true
else if (ops->alloc_pages)
^~~~~~~~~~~~~~~~~~~~~
kernel/dma/mapping.c:529:13: note: initialize the variable 'vaddr' to silence
this warning
void *vaddr;
^
= NULL
kernel/dma/mapping.c:554:2: error: implicit declaration of function
'dma_free_contiguous' [-Werror,-Wimplicit-function-declaration]
dma_free_contiguous(dev, virt_to_page(vaddr), size);
^
2 warnings and 3 errors generated.
git remote add hch-misc
git://git.infradead.org/users/hch/misc.git
git fetch --no-tags hch-misc dma_alloc_pages
git checkout ebfa77e612f8650cb120011030b7a9e951ebee56
vim +/dma_alloc_contiguous +512 kernel/dma/mapping.c
506
507 static void *dma_simple_alloc_pages(struct device *dev, size_t size,
508 dma_addr_t *dma_handle, gfp_t gfp)
509 {
510 struct page *page;
511
512 page = dma_alloc_contiguous(dev, size, gfp | __GFP_ZERO);
513 if (!page)
514 return NULL;
515 *dma_handle = dma_map_page_attrs(dev, page, 0, size, DMA_BIDIRECTIONAL,
516 DMA_ATTR_SKIP_CPU_SYNC);
517 if (dma_mapping_error(dev, *dma_handle)) {
518 dma_free_contiguous(dev, page, size);
519 return
NULL;
520 }
521
522 return page_address(page);
523 }
524
525 void *dma_alloc_pages(struct device *dev, size_t size, dma_addr_t *dma_handle,
526 gfp_t gfp)
527 {
528 const struct dma_map_ops *ops = get_dma_ops(dev);
529 void *vaddr;
530
531 if (WARN_ON_ONCE(!dev->coherent_dma_mask))
532 return NULL;
533 if (WARN_ON_ONCE(gfp & (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM |
534 __GFP_COMP)))
535 return NULL;
536
537 size = PAGE_ALIGN(size);
538 if (dma_alloc_direct(dev, ops))
539 vaddr = dma_direct_alloc_pages(dev, size, dma_handle, gfp);
540 else if (ops->alloc_pages)
541 vaddr =
ops->alloc_pages(dev, size, dma_handle, gfp);
542 else
543 dma_simple_alloc_pages(dev, size, dma_handle, gfp);
544
545 return vaddr;
546 }
547 EXPORT_SYMBOL_GPL(dma_alloc_pages);
548
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org