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 <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
(cherry picked from commit 03ac40aeed034a0a0d5824ad26f8fbe1f6463698)
Cc: [email protected]
This commit is contained in:
Perry Yuan authored and Alex Deucher committed 2026-10-15 12:45:38 -04:00
1 parent b5629f4a08
commit 5b0a459f99
1 file changed
+2
+2
View File
@@ -2081,6 +2081,7 @@ static int amdgpu_ttm_buffer_entity_init(struct amdgpu_gtt_mgr *mgr,
r = amdgpu_gtt_mgr_alloc_entries(mgr, &entity->gart_node, num_pages,
DRM_MM_INSERT_BEST);
if (r) {
mutex_destroy(&entity->lock);
drm_sched_entity_destroy(&entity->base);
return r;
}
@@ -2098,6 +2099,7 @@ static void amdgpu_ttm_buffer_entity_fini(struct amdgpu_gtt_mgr *mgr,
struct amdgpu_ttm_buffer_entity *entity)
{
amdgpu_gtt_mgr_free_entries(mgr, &entity->gart_node);
mutex_destroy(&entity->lock);
drm_sched_entity_destroy(&entity->base);
}