Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] lib/i915/perf: return NULL when platform is not supported
Date: Tue, 25 Feb 2020 13:22:18 +0200	[thread overview]
Message-ID: <20200225112218.1532204-1-lionel.g.landwerlin@intel.com> (raw)

Instead of asserting.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 lib/i915/perf.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/i915/perf.c b/lib/i915/perf.c
index 5b5b7f90..a5dd3eab 100644
--- a/lib/i915/perf.c
+++ b/lib/i915/perf.c
@@ -116,6 +116,13 @@ eu_available(const struct drm_i915_query_topology_info *topo,
 			   eu / 8] >> (eu % 8)) & 1;
 }
 
+static struct intel_perf *
+unsupported_i915_perf_platform(struct intel_perf *perf)
+{
+	intel_perf_free(perf);
+	return NULL;
+}
+
 struct intel_perf *
 intel_perf_for_devinfo(uint32_t device_id,
 		       uint32_t revision,
@@ -193,7 +200,7 @@ intel_perf_for_devinfo(uint32_t device_id,
 			intel_perf_load_metrics_sklgt4(perf);
 			break;
 		default:
-			assert(0); /* unreachable */
+			return unsupported_i915_perf_platform(perf);
 		}
 	} else if (devinfo->is_broxton) {
 		perf->devinfo.eu_threads_count = 6;
@@ -207,7 +214,7 @@ intel_perf_for_devinfo(uint32_t device_id,
 			intel_perf_load_metrics_kblgt3(perf);
 			break;
 		default:
-			assert(0); /* unreachable */
+			return unsupported_i915_perf_platform(perf);
 		}
 	} else if (devinfo->is_geminilake) {
 		perf->devinfo.eu_threads_count = 6;
@@ -221,7 +228,7 @@ intel_perf_for_devinfo(uint32_t device_id,
 			intel_perf_load_metrics_cflgt3(perf);
 			break;
 		default:
-			assert(0); /* unreachable */
+			return unsupported_i915_perf_platform(perf);
 		}
 	} else if (devinfo->is_cannonlake) {
 		intel_perf_load_metrics_cnl(perf);
@@ -232,7 +239,7 @@ intel_perf_for_devinfo(uint32_t device_id,
 	} else if (devinfo->is_tigerlake) {
 		intel_perf_load_metrics_tgl(perf);
 	} else {
-		assert(0); /* unreachable */
+		return unsupported_i915_perf_platform(perf);
 	}
 
 	return perf;
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2020-02-25 11:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 11:22 Lionel Landwerlin [this message]
2020-02-25 11:26 ` [igt-dev] [PATCH i-g-t] lib/i915/perf: return NULL when platform is not supported Lionel Landwerlin
2020-02-25 11:32   ` Petri Latvala
2020-02-25 12:26 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-02-26 15:12 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200225112218.1532204-1-lionel.g.landwerlin@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox