tree:
https://android.googlesource.com/kernel/common android-mainline
head: 8e1ec97355ef9927e82ec18c98312bdcd80bf289
commit: 349e8360c9c85c907147ea2d1d4716468409f2ab [3/4] ANDROID: dma-heap: Rework
allocation calls to return struct dma_buf instead of fd
config: x86_64-randconfig-a002-20200820 (attached as .config)
compiler: clang version 12.0.0 (
https://github.com/llvm/llvm-project
b587ca93be114d07ec3bf654add97d7872325281)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 349e8360c9c85c907147ea2d1d4716468409f2ab
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> drivers/dma-buf/heaps/cma_heap.c:43:17: warning: no previous
prototype for function 'cma_heap_allocate' [-Wmissing-prototypes]
struct
dma_buf *cma_heap_allocate(struct dma_heap *heap,
^
drivers/dma-buf/heaps/cma_heap.c:43:1: note: declare 'static' if the function
is not intended to be used outside of this translation unit
struct dma_buf *cma_heap_allocate(struct dma_heap *heap,
^
static
1 warning generated.
git remote add android-common
https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-mainline
git checkout 349e8360c9c85c907147ea2d1d4716468409f2ab
vim +/cma_heap_allocate +43 drivers/dma-buf/heaps/cma_heap.c
41
42 /* dmabuf heap CMA operations functions */
43 struct dma_buf *cma_heap_allocate(struct dma_heap *heap,
44 unsigned long len,
45 unsigned long fd_flags,
46 unsigned long heap_flags)
47 {
48 struct cma_heap *cma_heap = dma_heap_get_drvdata(heap);
49 struct heap_helper_buffer *helper_buffer;
50 struct page *cma_pages;
51 size_t size = PAGE_ALIGN(len);
52 unsigned long nr_pages = size >> PAGE_SHIFT;
53 unsigned long align = get_order(size);
54 struct dma_buf *dmabuf;
55 int ret = -ENOMEM;
56 pgoff_t pg;
57
58 if (align > CONFIG_CMA_ALIGNMENT)
59 align = CONFIG_CMA_ALIGNMENT;
60
61 helper_buffer = kzalloc(sizeof(*helper_buffer), GFP_KERNEL);
62 if (!helper_buffer)
63 return ERR_PTR(-ENOMEM);
64
65 init_heap_helper_buffer(helper_buffer, cma_heap_free);
66 helper_buffer->heap = heap;
67 helper_buffer->size = len;
68
69 cma_pages = cma_alloc(cma_heap->cma, nr_pages, align, false);
70 if (!cma_pages)
71 goto free_buf;
72
73 if (PageHighMem(cma_pages)) {
74 unsigned long nr_clear_pages = nr_pages;
75 struct page *page = cma_pages;
76
77 while (nr_clear_pages > 0) {
78 void *vaddr = kmap_atomic(page);
79
80 memset(vaddr, 0, PAGE_SIZE);
81 kunmap_atomic(vaddr);
82 /*
83 * Avoid wasting time zeroing memory if the process
84 * has been killed by by SIGKILL
85 */
86 if (fatal_signal_pending(current))
87 goto free_cma;
88
89 page++;
90 nr_clear_pages--;
91 }
92 } else {
93 memset(page_address(cma_pages), 0, size);
94 }
95
96 helper_buffer->pagecount = nr_pages;
97 helper_buffer->pages = kmalloc_array(helper_buffer->pagecount,
98 sizeof(*helper_buffer->pages),
99 GFP_KERNEL);
100 if (!helper_buffer->pages) {
101 ret = -ENOMEM;
102 goto free_cma;
103 }
104
105 for (pg = 0; pg < helper_buffer->pagecount; pg++)
106 helper_buffer->pages[pg] = &cma_pages[pg];
107
108 /* create the dmabuf */
109 dmabuf = heap_helper_export_dmabuf(helper_buffer, fd_flags);
110 if (IS_ERR(dmabuf)) {
111 ret = PTR_ERR(dmabuf);
112 goto free_pages;
113 }
114
115 helper_buffer->dmabuf = dmabuf;
116 helper_buffer->priv_virt = cma_pages;
117
118 return dmabuf;
119
120 free_pages:
121 kfree(helper_buffer->pages);
122 free_cma:
123 cma_release(cma_heap->cma, cma_pages, nr_pages);
124 free_buf:
125 kfree(helper_buffer);
126 return ERR_PTR(ret);
127 }
128
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org