[igt-dev] [PATCH i-g-t v15 1/3] igt/lib: Check if query_info is null

Stanislav Lisovskiy stanislav.lisovskiy at intel.com
Thu Dec 12 09:45:59 UTC 2019


From: "Lisovskiy, Stanislav" <stanislav.lisovskiy at intel.com>

On TGL ocassionally got a crash, as query_info
was 0, which caused crash. Don't know why it
wasn't(or if it was) noticed else where.

Regardless of what's the reason probably
checking is still better than crashing.

Change-Id: Ia407e44592a6357126bad3ed0c5fcaed1bd365d6
Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>
---
 lib/i915/intel_memory_region.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/i915/intel_memory_region.c b/lib/i915/intel_memory_region.c
index c3d9c814..c62ac6ad 100644
--- a/lib/i915/intel_memory_region.c
+++ b/lib/i915/intel_memory_region.c
@@ -127,6 +127,10 @@ uint8_t gem_get_lmem_region_count(int fd)
 	uint8_t lmem_regions = 0;
 
 	query_info = gem_get_query_memory_regions(fd);
+
+	if (!query_info)
+		return 0;
+
 	num_regions = query_info->num_regions;
 
 	for (int i = 0; i < num_regions; i++) {
-- 
2.17.1



More information about the igt-dev mailing list