[PATCH] drm/xe/oa: Fix static checker warning about null gt

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Tue Jul 15 21:49:31 UTC 2025


On Tue, Jul 15, 2025 at 11:14:22AM -0700, Ashutosh Dixit wrote:
>There is a static checker warning that gt returned by xe_device_get_gt can
>be NULL and that is being dereferenced. Use xe_root_mmio_gt instead, which
>is equivalent and cannot return a NULL gt 0.
>
>Fixes: 10d42ef34bce ("drm/xe/oa: Assign hwe for OAM_SAG")
>Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
>---
> drivers/gpu/drm/xe/xe_oa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
>index d991fbd90f201..5729e7d3e3356 100644
>--- a/drivers/gpu/drm/xe/xe_oa.c
>+++ b/drivers/gpu/drm/xe/xe_oa.c
>@@ -1941,7 +1941,7 @@ static int xe_oa_assign_hwe(struct xe_oa *oa, struct xe_oa_open_param *param)
>
> 	/* If not provided, OA unit defaults to OA unit 0 as per uapi */
> 	if (!param->oa_unit)
>-		param->oa_unit = &xe_device_get_gt(oa->xe, 0)->oa.oa_unit[0];
>+		param->oa_unit = &xe_root_mmio_gt(oa->xe)->oa.oa_unit[0];

LGTM,

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>

Thanks,
Umesh
>
> 	/* When we have an exec_q, get hwe from the exec_q */
> 	if (param->exec_q) {
>-- 
>2.48.1
>


More information about the Intel-xe mailing list