]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/xe/hw_engine_group: Don't use drm_warn to catch missed case
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 25 Jul 2025 09:05:08 +0000 (11:05 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Tue, 29 Jul 2025 15:25:06 +0000 (17:25 +0200)
Since hwe->class is an enumeration we can rely on the compiler
to catch any unhandled engine class case at compile time thanks
to [-Werror=switch]. Any unexpected use of a special CLASS_MAX
enum case can be guarded by our xe_gt_assert() instead, which
will be compiled-out on the production builds.

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

index c926f840c87b0f1365b45af413e1419ef32771a2..58bee3ffe881ada1e20178a4752fe37a2f24fc85 100644 (file)
@@ -103,8 +103,8 @@ int xe_hw_engine_setup_groups(struct xe_gt *gt)
                        break;
                case XE_ENGINE_CLASS_OTHER:
                        break;
-               default:
-                       drm_warn(&xe->drm, "NOT POSSIBLE");
+               case XE_ENGINE_CLASS_MAX:
+                       xe_gt_assert(gt, false);
                }
        }