Commit 28b1d915 authored by Bommithi Sakeena's avatar Bommithi Sakeena Committed by Rodrigo Vivi

drm/xe: Ensure mutex are destroyed

Add missing mutex_destroy calls to fini functions or convert to
drmm_mutex_init where fini function is not available.

Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarBommithi Sakeena <bommithi.sakeena@intel.com>
Reviewed-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 5349bb76
...@@ -137,7 +137,7 @@ int xe_guc_ct_init(struct xe_guc_ct *ct) ...@@ -137,7 +137,7 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
xe_assert(xe, !(guc_ct_size() % PAGE_SIZE)); xe_assert(xe, !(guc_ct_size() % PAGE_SIZE));
mutex_init(&ct->lock); drmm_mutex_init(&xe->drm, &ct->lock);
spin_lock_init(&ct->fast_lock); spin_lock_init(&ct->fast_lock);
xa_init(&ct->fence_lookup); xa_init(&ct->fence_lookup);
INIT_WORK(&ct->g2h_worker, g2h_worker_func); INIT_WORK(&ct->g2h_worker, g2h_worker_func);
......
...@@ -890,6 +890,7 @@ void xe_guc_pc_fini(struct xe_guc_pc *pc) ...@@ -890,6 +890,7 @@ void xe_guc_pc_fini(struct xe_guc_pc *pc)
XE_WARN_ON(xe_guc_pc_stop(pc)); XE_WARN_ON(xe_guc_pc_stop(pc));
sysfs_remove_files(pc_to_gt(pc)->sysfs, pc_attrs); sysfs_remove_files(pc_to_gt(pc)->sysfs, pc_attrs);
xe_bo_unpin_map_no_vm(pc->bo); xe_bo_unpin_map_no_vm(pc->bo);
mutex_destroy(&pc->freq_lock);
} }
/** /**
......
...@@ -195,6 +195,7 @@ static void guc_submit_fini(struct drm_device *drm, void *arg) ...@@ -195,6 +195,7 @@ static void guc_submit_fini(struct drm_device *drm, void *arg)
xa_destroy(&guc->submission_state.exec_queue_lookup); xa_destroy(&guc->submission_state.exec_queue_lookup);
ida_destroy(&guc->submission_state.guc_ids); ida_destroy(&guc->submission_state.guc_ids);
bitmap_free(guc->submission_state.guc_ids_bitmap); bitmap_free(guc->submission_state.guc_ids_bitmap);
mutex_destroy(&guc->submission_state.lock);
} }
#define GUC_ID_MAX 65535 #define GUC_ID_MAX 65535
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <drm/drm_managed.h>
#include "xe_gt.h" #include "xe_gt.h"
#include "xe_mmio.h" #include "xe_mmio.h"
#include "xe_pcode_api.h" #include "xe_pcode_api.h"
...@@ -276,7 +278,7 @@ int xe_pcode_init(struct xe_gt *gt) ...@@ -276,7 +278,7 @@ int xe_pcode_init(struct xe_gt *gt)
*/ */
int xe_pcode_probe(struct xe_gt *gt) int xe_pcode_probe(struct xe_gt *gt)
{ {
mutex_init(&gt->pcode.lock); drmm_mutex_init(&gt_to_xe(gt)->drm, &gt->pcode.lock);
if (!IS_DGFX(gt_to_xe(gt))) if (!IS_DGFX(gt_to_xe(gt)))
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment