Commit

5b0a459f990be2faba33229fd93f10f23745fab2

drm/amdgpu: destroy mutex when tearing down ttm buffer entity

Pair mutex_init() with mutex_destroy() on the GART window allocation
failure path and in amdgpu_ttm_buffer_entity_fini(). This is a no-op
without CONFIG_DEBUG_MUTEXES, but it keeps lockdep from seeing a live
mutex after the entity is freed or re-initialized.

Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 03ac40aeed034a0a0d5824ad26f8fbe1f6463698)
Cc: stable@vger.kernel.org

Perry Yuan <perry.yuan@amd.com> · 2026-09-10 08:58 UTC · committed by Alex Deucher

Browse files
1 file changed, +2 −0
modified drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2081,6 +2081,7 @@ static int amdgpu_ttm_buffer_entity_init(struct amdgpu_gtt_mgr *mgr,
2081 2081 r = amdgpu_gtt_mgr_alloc_entries(mgr, &entity->gart_node, num_pages,
2082 2082 DRM_MM_INSERT_BEST);
2083 2083 if (r) {
2084 + mutex_destroy(&entity->lock);
2084 2085 drm_sched_entity_destroy(&entity->base);
2085 2086 return r;
2086 2087 }
@@ -2098,6 +2099,7 @@ static void amdgpu_ttm_buffer_entity_fini(struct amdgpu_gtt_mgr *mgr,
2098 2099 struct amdgpu_ttm_buffer_entity *entity)
2099 2100 {
2100 2101 amdgpu_gtt_mgr_free_entries(mgr, &entity->gart_node);
2102 + mutex_destroy(&entity->lock);
2101 2103 drm_sched_entity_destroy(&entity->base);
2102 2104 }
2103 2105