From: Tejas Upadhyay Date: Wed, 29 Apr 2026 09:31:39 +0000 (+0530) Subject: drm/xe: Use drmm_mutex_init for VRAM manager lock X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=438a9200d6abdae2be64a5ce085cee0244a7c231;p=thirdparty%2Fkernel%2Flinux.git drm/xe: Use drmm_mutex_init for VRAM manager lock Replace mutex_init()/mutex_destroy() with drmm_mutex_init() for the VRAM manager lock. This leverages DRM managed infrastructure to automatically destroy the mutex during device teardown, eliminating manual mutex_destroy() calls in both the normal fini path and the gpu_buddy_init() error path. Assisted-by: Claude:claude-opus-4.6 Reviewed-by: Matthew Auld Reviewed-by: Matthew Brost Link: https://patch.msgid.link/20260429093138.3899280-2-tejas.upadhyay@intel.com Signed-off-by: Tejas Upadhyay --- diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c index 5fd0d5506a7ea..6ba47996bc7c1 100644 --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c @@ -292,8 +292,6 @@ static void xe_ttm_vram_mgr_fini(struct drm_device *dev, void *arg) ttm_resource_manager_cleanup(&mgr->manager); ttm_set_driver_manager(&xe->ttm, mgr->mem_type, NULL); - - mutex_destroy(&mgr->lock); } int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr, @@ -312,7 +310,9 @@ int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr, man->func = &xe_ttm_vram_mgr_func; mgr->mem_type = mem_type; - mutex_init(&mgr->lock); + err = drmm_mutex_init(&xe->drm, &mgr->lock); + if (err) + return err; mgr->default_page_size = default_page_size; mgr->visible_size = io_size; mgr->visible_avail = io_size;