intel/perf: fix crash when no perf queries are supported
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 6 Oct 2020 08:38:54 +0000 (11:38 +0300)
committerMarge Bot <eric+marge@anholt.net>
Tue, 6 Oct 2020 10:20:57 +0000 (10:20 +0000)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: ec1fa1d51ff614 ("intel/perf: fix raw query kernel metric selection")
Reviewed-by: Marcin Ĺšlusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7024>

src/intel/perf/gen_perf.c

index d9f2050..b9fee6e 100644 (file)
@@ -781,7 +781,7 @@ load_oa_metrics(struct gen_perf_config *perf, int fd,
          break;
       }
    }
-   if (perf->fallback_raw_oa_metric == 0)
+   if (perf->fallback_raw_oa_metric == 0 && perf->n_queries > 0)
       perf->fallback_raw_oa_metric = perf->queries[perf->n_queries - 1].oa_metrics_set_id;
 }