Skip to content

Commit 7bd9c9f

Browse files
dceraololucasdemarchi
authored andcommitted
drm/xe/guc: Check error code when initializing the CT mutex
The initialization via drmm_mutex_init can fail, so we need to check the return code and escalate the failure. The mutex initialization has been moved after all the other init steps that can't fail, so we're always guaranteed to have those done and don't have to check in the cleanup code. Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Reviewed-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240321195512.274210-1-daniele.ceraolospurio@intel.com (cherry picked from commit b4abeb5) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent 2d4b74a commit 7bd9c9f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpu/drm/xe/xe_guc_ct.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,16 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
145145

146146
xe_assert(xe, !(guc_ct_size() % PAGE_SIZE));
147147

148-
drmm_mutex_init(&xe->drm, &ct->lock);
149148
spin_lock_init(&ct->fast_lock);
150149
xa_init(&ct->fence_lookup);
151150
INIT_WORK(&ct->g2h_worker, g2h_worker_func);
152151
init_waitqueue_head(&ct->wq);
153152
init_waitqueue_head(&ct->g2h_fence_wq);
154153

154+
err = drmm_mutex_init(&xe->drm, &ct->lock);
155+
if (err)
156+
return err;
157+
155158
primelockdep(ct);
156159

157160
bo = xe_managed_bo_create_pin_map(xe, tile, guc_ct_size(),

0 commit comments

Comments
 (0)