[PATCH] drm/xe: Fix coverity issue, truncation warning

Pravalika Gurram pravalika.gurram at intel.com
Mon Aug 4 10:44:09 UTC 2025


Use conditional assignment to avoid cast truncation warning.
Set instance to 0 when hw_reports_to_instance_zero() returns false.

Fixes: 95336cfd5b2ce ("drm/xe: Add memirq report page address helpers")

Signed-off-by: Pravalika Gurram <pravalika.gurram at intel.com>
---
 drivers/gpu/drm/xe/xe_memirq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_memirq.c b/drivers/gpu/drm/xe/xe_memirq.c
index 49c45ec3e83c..75ddf4eda355 100644
--- a/drivers/gpu/drm/xe/xe_memirq.c
+++ b/drivers/gpu/drm/xe/xe_memirq.c
@@ -257,7 +257,8 @@ static u32 __memirq_source_page(struct xe_memirq *memirq, u16 instance)
 	memirq_assert(memirq, instance <= XE_HW_ENGINE_MAX_INSTANCE);
 	memirq_assert(memirq, memirq->bo);
 
-	instance = hw_reports_to_instance_zero(memirq) ? instance : 0;
+	if (!hw_reports_to_instance_zero(memirq))
+		instance = 0;
 	return xe_bo_ggtt_addr(memirq->bo) + XE_MEMIRQ_SOURCE_OFFSET(instance);
 }
 
-- 
2.34.1



More information about the Intel-xe mailing list