From ebe8d2f9ea5c1cc1099eda232aa14e43b9bb2655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Thu, 2 May 2024 14:15:12 -0700 Subject: [PATCH] intel/perf: Add intel_perf_free() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was no function to free resources allocated in intel_perf_config or it self. Other callers will be added in separated patches. Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/perf/intel_perf.c | 6 ++++++ src/intel/perf/intel_perf.h | 2 ++ src/intel/perf/intel_perf_query_layout.c | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/intel/perf/intel_perf.c b/src/intel/perf/intel_perf.c index 385862a4a97..605dff30bde 100644 --- a/src/intel/perf/intel_perf.c +++ b/src/intel/perf/intel_perf.c @@ -1561,3 +1561,9 @@ intel_perf_init_metrics(struct intel_perf_config *perf_cfg, if (oa_metrics) intel_perf_register_mdapi_oa_query(perf_cfg, devinfo); } + +void +intel_perf_free(struct intel_perf_config *perf_cfg) +{ + ralloc_free(perf_cfg); +} diff --git a/src/intel/perf/intel_perf.h b/src/intel/perf/intel_perf.h index 6462a8faf32..464401e4870 100644 --- a/src/intel/perf/intel_perf.h +++ b/src/intel/perf/intel_perf.h @@ -532,6 +532,8 @@ intel_perf_new(void *ctx) return perf; } +void intel_perf_free(struct intel_perf_config *perf_cfg); + /** Whether we have the ability to hold off preemption on a batch so we don't * have to look at the OA buffer to subtract unrelated workloads off the * values captured through MI_* commands. diff --git a/src/intel/perf/intel_perf_query_layout.c b/src/intel/perf/intel_perf_query_layout.c index 3dd30b20805..dc423cf8d50 100644 --- a/src/intel/perf/intel_perf_query_layout.c +++ b/src/intel/perf/intel_perf_query_layout.c @@ -100,6 +100,7 @@ main(int argc, char *argv[]) if (!perf_cfg->i915_query_supported) { fprintf(stderr, "No supported queries for platform.\n"); + intel_perf_free(perf_cfg); return EXIT_FAILURE; } @@ -133,5 +134,6 @@ main(int argc, char *argv[]) } } + intel_perf_free(perf_cfg); return EXIT_SUCCESS; }