mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
dma-buf/test: add KUnit case for dma_fence_dedup_array() empty input
Add a KUnit case verifying that dma_fence_dedup_array() returns 0,
not 1, when called with num_fences == 0. This locks down the
contract documented in the kernel-doc and prevents a regression
of commit 77a9298741 ("dma-fence: Make dma_fence_dedup_array()
robust against 0-count input").
Suggested-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Baineng Shou <shoubaineng@gmail.com>
Link: https://lore.kernel.org/r/20261014024909.1769215-1-shoubaineng@gmail.com
Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
dfc3c7b84d
commit
91f52e9982
|
|
@ -370,6 +370,15 @@ static void test_unwrap_merge_seqno(struct kunit *test)
|
|||
dma_fence_put(f1);
|
||||
}
|
||||
|
||||
static void test_dedup_empty(struct kunit *test)
|
||||
{
|
||||
struct dma_fence *fence[1] = { NULL };
|
||||
int ret;
|
||||
|
||||
ret = dma_fence_dedup_array(fence, 0);
|
||||
KUNIT_EXPECT_EQ(test, ret, 0);
|
||||
}
|
||||
|
||||
static void test_unwrap_merge_order(struct kunit *test)
|
||||
{
|
||||
struct dma_fence *fence, *f1, *f2, *a1, *a2, *c1, *c2;
|
||||
|
|
@ -595,6 +604,7 @@ static struct kunit_case dma_fence_unwrap_cases[] = {
|
|||
KUNIT_CASE(test_unwrap_merge_order),
|
||||
KUNIT_CASE(test_unwrap_merge_complex),
|
||||
KUNIT_CASE(test_unwrap_merge_complex_seqno),
|
||||
KUNIT_CASE(test_dedup_empty),
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user