From 42d1157c1d405407f381c3d888490b2ca326cdf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=98=8E?= Date: Wed, 10 May 2023 01:24:44 +0000 Subject: [PATCH] Fix a bug that pointer is used first and checked later MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王明 --- drivers/dma-buf/dma-fence.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 1551ca7df394..b3832cf83bb0 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -104,10 +104,9 @@ int dma_fence_signal_locked(struct dma_fence *fence) struct dma_fence_cb *cur, *tmp; int ret = 0; - lockdep_assert_held(fence->lock); - if (WARN_ON(!fence)) return -EINVAL; + lockdep_assert_held(fence->lock); if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { ret = -EINVAL; -- Gitee