[PATCH 4/6] dma-buf: Don't misuse dma_fence_signal()

Philipp Stanner
2025-11-26T13:20:27Z

The return code of dma_fence_signal() is not really useful as there is
nothing reasonable to do if a fence was already signaled. That return
code shall be removed from the kernel.

Moreover, dma_fence_signal() should not be used to check whether fences
are signaled. That's what dma_fence_is_signaled() and
dma_fence_test_signaled_flag() exist for.

Replace the non-canonical usage of dma_fence_signal().

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
drivers/dma-buf/st-dma-fence.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/dma-buf/st-dma-fence.c b/drivers/dma-buf/st-dma-fence.c
index 27a36045410b..9fc93859f36f 100644
--- a/drivers/dma-buf/st-dma-fence.c
+++ b/drivers/dma-buf/st-dma-fence.c
@@ -126,17 +126,14 @@ static int test_signaling(void *arg)
goto err_free;
}

- if (dma_fence_signal(f)) {
- pr_err("Fence reported being already signaled\n");
- goto err_free;
- }
+ dma_fence_signal(f);

if (!dma_fence_is_signaled(f)) {
pr_err("Fence not reporting signaled\n");
goto err_free;
}

- if (!dma_fence_signal(f)) {
+ if (!dma_fence_test_signaled_flag(f)) {
pr_err("Fence reported not being already signaled\n");
goto err_free;
}
--
2.49.0