]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dma-buf: Suppress a thread-safety complaint
authorBart Van Assche <bvanassche@acm.org>
Fri, 27 Feb 2026 16:55:01 +0000 (08:55 -0800)
committerChristian König <christian.koenig@amd.com>
Tue, 3 Mar 2026 07:39:13 +0000 (08:39 +0100)
Handle all possible dma_resv_lock() return values. This patch prepares
for enabling compile-time thread-safety analysis. This will cause the
compiler to check whether all dma_resv_lock() return values are handled.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20260227165501.2062829-1-bvanassche@acm.org
drivers/dma-buf/dma-resv.c

index bea3e9858aca568807230084f24a867478659b5c..ce9e6c04897ffbc6afd72eb2856e4c94e52f3880 100644 (file)
@@ -790,8 +790,11 @@ static int __init dma_resv_lockdep(void)
        mmap_read_lock(mm);
        ww_acquire_init(&ctx, &reservation_ww_class);
        ret = dma_resv_lock(&obj, &ctx);
-       if (ret == -EDEADLK)
+       if (ret) {
+               /* Only EDEADLK from the error injection is possible here */
+               WARN_ON(ret != -EDEADLK);
                dma_resv_lock_slow(&obj, &ctx);
+       }
        fs_reclaim_acquire(GFP_KERNEL);
        /* for unmap_mapping_range on trylocked buffer objects in shrinkers */
        i_mmap_lock_write(&mapping);