]> www.infradead.org Git - linux.git/commitdiff
drm/xe/device: fix XE_MAX_TILES_PER_DEVICE check
authorMatthew Auld <matthew.auld@intel.com>
Mon, 18 Mar 2024 18:05:35 +0000 (18:05 +0000)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 25 Mar 2024 18:45:32 +0000 (13:45 -0500)
Here XE_MAX_TILES_PER_DEVICE is the gt array size, therefore the gt
index should always be less than.

v2 (Lucas):
  - Add fixes tag.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Acked-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240318180532.57522-6-matthew.auld@intel.com
(cherry picked from commit a96cd71ec7be0790f9fc4039ad21be8d214b03a4)
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_device.h

index 5c254ec9c602e4c230040a73567679fcc627f6ef..d413bc2c6be5a070d26f9bea32b4e979d5d4a912 100644 (file)
@@ -79,7 +79,7 @@ static inline struct xe_gt *xe_device_get_gt(struct xe_device *xe, u8 gt_id)
        if (MEDIA_VER(xe) >= 13) {
                gt = xe_tile_get_gt(root_tile, gt_id);
        } else {
-               if (drm_WARN_ON(&xe->drm, gt_id > XE_MAX_TILES_PER_DEVICE))
+               if (drm_WARN_ON(&xe->drm, gt_id >= XE_MAX_TILES_PER_DEVICE))
                        gt_id = 0;
 
                gt = xe->tiles[gt_id].primary_gt;