]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Detect GT workqueue allocation failure
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 1 Oct 2025 14:40:51 +0000 (16:40 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Thu, 2 Oct 2025 16:48:10 +0000 (18:48 +0200)
The allocation of the per-GT workqueue may fail and we shouldn't
ignore that.  While around use drm managed allocation function
to drop our custom fini action.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20251001144051.202040-1-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_gt.c

index 3e0ad7e5b5dfbae711ad153a7b588d155b52abf7..b77572a195486d5e0b527b830f120008ef0e24e9 100644 (file)
 #include "xe_wa.h"
 #include "xe_wopcm.h"
 
-static void gt_fini(struct drm_device *drm, void *arg)
-{
-       struct xe_gt *gt = arg;
-
-       destroy_workqueue(gt->ordered_wq);
-}
-
 struct xe_gt *xe_gt_alloc(struct xe_tile *tile)
 {
+       struct drm_device *drm = &tile_to_xe(tile)->drm;
        struct xe_gt *gt;
-       int err;
 
-       gt = drmm_kzalloc(&tile_to_xe(tile)->drm, sizeof(*gt), GFP_KERNEL);
+       gt = drmm_kzalloc(drm, sizeof(*gt), GFP_KERNEL);
        if (!gt)
                return ERR_PTR(-ENOMEM);
 
        gt->tile = tile;
-       gt->ordered_wq = alloc_ordered_workqueue("gt-ordered-wq",
-                                                WQ_MEM_RECLAIM);
-
-       err = drmm_add_action_or_reset(&gt_to_xe(gt)->drm, gt_fini, gt);
-       if (err)
-               return ERR_PTR(err);
+       gt->ordered_wq = drmm_alloc_ordered_workqueue(drm, "gt-ordered-wq", WQ_MEM_RECLAIM);
+       if (IS_ERR(gt->ordered_wq))
+               return ERR_CAST(gt->ordered_wq);
 
        return gt;
 }