Re: [PATCH 2/4] dma-buf: add dma_resv_get_singleton_rcu (v4)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jason,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tegra-drm/drm/tegra/for-next]
[also build test WARNING on linus/master v5.13-rc2 next-20210521]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jason-Ekstrand/dma-buf-Add-an-API-for-exporting-sync-files-v8/20210522-201251
base:   git://anongit.freedesktop.org/tegra/linux.git drm/tegra/for-next
config: x86_64-randconfig-s031-20210522 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/925221f402201e7b1f665619dda2c5ee6d6324f1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jason-Ekstrand/dma-buf-Add-an-API-for-exporting-sync-files-v8/20210522-201251
        git checkout 925221f402201e7b1f665619dda2c5ee6d6324f1
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/dma-buf/dma-resv.c:550: warning: expecting prototype for dma_resv_get_singleton(). Prototype was for dma_resv_get_singleton_rcu() instead


vim +550 drivers/dma-buf/dma-resv.c

   534	
   535	/**
   536	 * dma_resv_get_singleton - get a single fence for the dma_resv object
   537	 * @obj: the reservation object
   538	 * @extra: extra fence to add to the resulting array
   539	 * @result: resulting dma_fence
   540	 *
   541	 * Get a single fence representing all unsignaled fences in the dma_resv object
   542	 * plus the given extra fence. If we got only one fence return a new
   543	 * reference to that, otherwise return a dma_fence_array object.
   544	 *
   545	 * RETURNS
   546	 * Returns -NOMEM if allocations fail, zero otherwise.
   547	 */
   548	int dma_resv_get_singleton_rcu(struct dma_resv *obj, struct dma_fence *extra,
   549				       struct dma_fence **result)
 > 550	{
   551		struct dma_fence **resv_fences, *fence, *chain, **fences;
   552		struct dma_fence_array *array;
   553		unsigned int num_resv_fences, num_fences;
   554		unsigned int ret, i, j;
   555	
   556		ret = dma_resv_get_fences_rcu(obj, NULL, &num_resv_fences, &resv_fences);
   557		if (ret)
   558			return ret;
   559	
   560		num_fences = 0;
   561		*result = NULL;
   562	
   563		if (num_resv_fences == 0 && !extra)
   564			return 0;
   565	
   566		for (i = 0; i < num_resv_fences; ++i) {
   567			dma_fence_deep_dive_for_each(fence, chain, j, resv_fences[i]) {
   568				if (dma_fence_is_signaled(fence))
   569					continue;
   570	
   571				*result = fence;
   572				++num_fences;
   573			}
   574		}
   575	
   576		if (extra) {
   577			dma_fence_deep_dive_for_each(fence, chain, j, extra) {
   578				if (dma_fence_is_signaled(fence))
   579					continue;
   580	
   581				*result = fence;
   582				++num_fences;
   583			}
   584		}
   585	
   586		if (num_fences <= 1) {
   587			*result = dma_fence_get(*result);
   588			goto put_resv_fences;
   589		}
   590	
   591		fences = kmalloc_array(num_fences, sizeof(struct dma_fence*),
   592				       GFP_KERNEL);
   593		if (!fences) {
   594			*result = NULL;
   595			ret = -ENOMEM;
   596			goto put_resv_fences;
   597		}
   598	
   599		num_fences = 0;
   600		for (i = 0; i < num_resv_fences; ++i) {
   601			dma_fence_deep_dive_for_each(fence, chain, j, resv_fences[i]) {
   602				if (!dma_fence_is_signaled(fence))
   603					fences[num_fences++] = dma_fence_get(fence);
   604			}
   605		}
   606	
   607		if (extra) {
   608			dma_fence_deep_dive_for_each(fence, chain, j, extra) {
   609				if (dma_fence_is_signaled(fence))
   610					fences[num_fences++] = dma_fence_get(fence);
   611			}
   612		}
   613	
   614		if (num_fences <= 1) {
   615			*result = num_fences ? fences[0] : NULL;
   616			kfree(fences);
   617			goto put_resv_fences;
   618		}
   619	
   620		array = dma_fence_array_create(num_fences, fences,
   621					       dma_fence_context_alloc(1),
   622					       1, false);
   623		if (array) {
   624			*result = &array->base;
   625		} else {
   626			*result = NULL;
   627			while (num_fences--)
   628				dma_fence_put(fences[num_fences]);
   629			kfree(fences);
   630			ret = -ENOMEM;
   631		}
   632	
   633	put_resv_fences:
   634		while (num_resv_fences--)
   635			dma_fence_put(resv_fences[num_resv_fences]);
   636		kfree(resv_fences);
   637	
   638		return ret;
   639	}
   640	EXPORT_SYMBOL_GPL(dma_resv_get_singleton_rcu);
   641	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux