Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma-buf: Warn about dma_fence_chain container rules v2

Chaining of dma_fence_chain objects is only allowed through the prev
fence and not through the contained fence.

Warn about that when we create a dma_fence_chain.

v2: fix comment style

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220204100429.2049-4-christian.koenig@amd.com

+9
+9
drivers/dma-buf/dma-fence-chain.c
··· 254 254 255 255 dma_fence_init(&chain->base, &dma_fence_chain_ops, 256 256 &chain->lock, context, seqno); 257 + 258 + /* 259 + * Chaining dma_fence_chain container together is only allowed through 260 + * the prev fence and not through the contained fence. 261 + * 262 + * The correct way of handling this is to flatten out the fence 263 + * structure into a dma_fence_array by the caller instead. 264 + */ 265 + WARN_ON(dma_fence_is_chain(fence)); 257 266 } 258 267 EXPORT_SYMBOL(dma_fence_chain_init);