]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: make non-NULL out fence mandatory
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 5 Sep 2025 08:19:29 +0000 (10:19 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 13 Oct 2025 18:14:33 +0000 (14:14 -0400)
amdgpu_ttm_copy_mem_to_mem has a single caller, make sure the out
fence is non-NULL to simplify the code.
Since none of the pointers should be NULL, we can enable
__attribute__((nonnull))__.

While at it make the function static since it's only used from
amdgpuu_ttm.c.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h

index 2fb8cd79583e874513d1af893013bc5f5fa28b5f..86fc1809681c31edc7e0551a923f14619ea683ad 100644 (file)
@@ -286,12 +286,13 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,
  * move and different for a BO to BO copy.
  *
  */
-int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
-                              const struct amdgpu_copy_mem *src,
-                              const struct amdgpu_copy_mem *dst,
-                              uint64_t size, bool tmz,
-                              struct dma_resv *resv,
-                              struct dma_fence **f)
+__attribute__((nonnull))
+static int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
+                                     const struct amdgpu_copy_mem *src,
+                                     const struct amdgpu_copy_mem *dst,
+                                     uint64_t size, bool tmz,
+                                     struct dma_resv *resv,
+                                     struct dma_fence **f)
 {
        struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
        struct amdgpu_res_cursor src_mm, dst_mm;
@@ -365,9 +366,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
        }
 error:
        mutex_unlock(&adev->mman.gtt_window_lock);
-       if (f)
-               *f = dma_fence_get(fence);
-       dma_fence_put(fence);
+       *f = fence;
        return r;
 }
 
index bbd6e524de9ec81f2a08ac650f29451a6586e270..d75866a389f1ead94e38e0a93c744ca24c4705c5 100644 (file)
@@ -170,12 +170,6 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
                       struct dma_resv *resv,
                       struct dma_fence **fence, bool direct_submit,
                       bool vm_needs_flush, uint32_t copy_flags);
-int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
-                              const struct amdgpu_copy_mem *src,
-                              const struct amdgpu_copy_mem *dst,
-                              uint64_t size, bool tmz,
-                              struct dma_resv *resv,
-                              struct dma_fence **f);
 int amdgpu_ttm_clear_buffer(struct amdgpu_bo *bo,
                            struct dma_resv *resv,
                            struct dma_fence **fence);