]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
coresight: fix missing error code when trace ID is invalid
authorJie Gan <jie.gan@oss.qualcomm.com>
Tue, 12 May 2026 01:56:07 +0000 (09:56 +0800)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 12 May 2026 15:33:23 +0000 (16:33 +0100)
commitf4526ffee6ff9f5845b430957417149eded74bf3
treeeaf9b478b911d41b46d441588e0070efc22177d1
parent0ec0a8785d21f63db520bd9d2a67c55e855d36a8
coresight: fix missing error code when trace ID is invalid

When coresight_path_assign_trace_id() cannot assign a valid trace ID,
coresight_enable_sysfs() takes the err_path goto with ret still 0,
returning success to the caller despite no trace session being started.

Change coresight_path_assign_trace_id() to return int, moving the
IS_VALID_CS_TRACE_ID() check inside it so it returns -EINVAL on failure
and 0 on success. Update both callers to propagate this return value
directly instead of inspecting path->trace_id after the call.

Fixes: d87d76d823d1 ("Coresight: Allocate trace ID after building the path")
Reviewed-by: James Clark <james.clark@linaro.org>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20260512-fix-trace-id-error-v4-1-eb3de789767a@oss.qualcomm.com
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-etm-perf.c
drivers/hwtracing/coresight/coresight-priv.h
drivers/hwtracing/coresight/coresight-sysfs.c