[Intel-gfx] [PATCH] dma-buf: add struct dma_buf_attach_info v2

kbuild test robot lkp at intel.com
Tue Apr 30 15:23:56 UTC 2019


Hi "Christian,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.1-rc7 next-20190429]
[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/Christian-K-nig/dma-buf-add-struct-dma_buf_attach_info-v2/20190430-221017
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.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.1.0 make.cross ARCH=xtensa 

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

All errors (new ones prefixed by >>):

   drivers/staging/media/tegra-vde/tegra-vde.c: In function 'tegra_vde_attach_dmabuf':
>> drivers/staging/media/tegra-vde/tegra-vde.c:573:13: error: 'dmabuf' undeclared (first use in this function); did you mean 'dma_buf'?
      .dmabuf = dmabuf
                ^~~~~~
                dma_buf
   drivers/staging/media/tegra-vde/tegra-vde.c:573:13: note: each undeclared identifier is reported only once for each function it appears in

vim +573 drivers/staging/media/tegra-vde/tegra-vde.c

   559	
   560	static int tegra_vde_attach_dmabuf(struct device *dev,
   561					   int fd,
   562					   unsigned long offset,
   563					   size_t min_size,
   564					   size_t align_size,
   565					   struct dma_buf_attachment **a,
   566					   dma_addr_t *addr,
   567					   struct sg_table **s,
   568					   size_t *size,
   569					   enum dma_data_direction dma_dir)
   570	{
   571		struct dma_buf_attach_info attach_info = {
   572			.dev = dev,
 > 573			.dmabuf = dmabuf
   574		};
   575		struct dma_buf_attachment *attachment;
   576		struct dma_buf *dmabuf;
   577		struct sg_table *sgt;
   578		int err;
   579	
   580		dmabuf = dma_buf_get(fd);
   581		if (IS_ERR(dmabuf)) {
   582			dev_err(dev, "Invalid dmabuf FD\n");
   583			return PTR_ERR(dmabuf);
   584		}
   585	
   586		if (dmabuf->size & (align_size - 1)) {
   587			dev_err(dev, "Unaligned dmabuf 0x%zX, should be aligned to 0x%zX\n",
   588				dmabuf->size, align_size);
   589			return -EINVAL;
   590		}
   591	
   592		if ((u64)offset + min_size > dmabuf->size) {
   593			dev_err(dev, "Too small dmabuf size %zu @0x%lX, should be at least %zu\n",
   594				dmabuf->size, offset, min_size);
   595			return -EINVAL;
   596		}
   597	
   598		attachment = dma_buf_attach(&attach_info);
   599		if (IS_ERR(attachment)) {
   600			dev_err(dev, "Failed to attach dmabuf\n");
   601			err = PTR_ERR(attachment);
   602			goto err_put;
   603		}
   604	
   605		sgt = dma_buf_map_attachment(attachment, dma_dir);
   606		if (IS_ERR(sgt)) {
   607			dev_err(dev, "Failed to get dmabufs sg_table\n");
   608			err = PTR_ERR(sgt);
   609			goto err_detach;
   610		}
   611	
   612		if (sgt->nents != 1) {
   613			dev_err(dev, "Sparse DMA region is unsupported\n");
   614			err = -EINVAL;
   615			goto err_unmap;
   616		}
   617	
   618		*addr = sg_dma_address(sgt->sgl) + offset;
   619		*a = attachment;
   620		*s = sgt;
   621	
   622		if (size)
   623			*size = dmabuf->size - offset;
   624	
   625		return 0;
   626	
   627	err_unmap:
   628		dma_buf_unmap_attachment(attachment, sgt, dma_dir);
   629	err_detach:
   630		dma_buf_detach(dmabuf, attachment);
   631	err_put:
   632		dma_buf_put(dmabuf);
   633	
   634		return err;
   635	}
   636	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 56166 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190430/7199b671/attachment-0001.gz>


More information about the dri-devel mailing list