[PATCH 05/10] gtrace: Terminate id_table iteration on GTRACE_COMPONENT_TYPE_NONE

From: Leo Yu-Chi Liang

Date: Thu Nov 26 2026 - 04:07:48 EST


gtrace_match_id() uses a non-zero id->version as the end-of-table
sentinel when walking a driver's id_table. This does not work for
pre-ratified components, whose version is 0, i.e.
rvtrace_component_mkversion(0, 0): an id_table holding only such an
entry is treated as empty, so the component never matches its driver.

Add GTRACE_COMPONENT_TYPE_NONE as the zero value of enum
gtrace_component_type and use it as the terminator instead. Existing
id_tables end with an empty entry, which maps to this value.

Signed-off-by: Leo Yu-Chi Liang <leo.liang@xxxxxxxxxx>
---
drivers/hwtracing/gtrace/gtrace-core.c | 2 +-
include/linux/gtrace.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/gtrace/gtrace-core.c b/drivers/hwtracing/gtrace/gtrace-core.c
index 034987237abc..09b200bd1690 100644
--- a/drivers/hwtracing/gtrace/gtrace-core.c
+++ b/drivers/hwtracing/gtrace/gtrace-core.c
@@ -103,7 +103,7 @@ const struct gtrace_component_id *gtrace_match_id(struct gtrace_component *comp,
{
const struct gtrace_component_id *id;

- for (id = ids; id->version; id++) {
+ for (id = ids; id->type != GTRACE_COMPONENT_TYPE_NONE; id++) {
if (comp->id.type != id->type)
continue;

diff --git a/include/linux/gtrace.h b/include/linux/gtrace.h
index da8ba3779193..b8826b25d35a 100644
--- a/include/linux/gtrace.h
+++ b/include/linux/gtrace.h
@@ -19,6 +19,7 @@
* uses the entries relevant to it.
*/
enum gtrace_component_type {
+ GTRACE_COMPONENT_TYPE_NONE,
GTRACE_RVTRACE_ENCODER,
GTRACE_RVTRACE_FUNNEL,
GTRACE_RVTRACE_RAMSINK,

--
2.43.7