etm_parse_event_config() can fail, for example if an invalid timestamp level is requested, but etm_enable_perf() ignores the error and enables the tracer anyway. Roll back to disabled mode and return the error instead, like etm4_enable_perf() does.
Fixes: 882d5e112491 ("coresight: etm3x: implementing perf_enable/disable() API") Reported-by: Sashiko sashiko-bot@kernel.org Closes: https://sashiko.dev/#/bug/linux-bc35b336-f835-40fa-89d9-7a580efc3b53 Signed-off-by: James Clark james.clark@linaro.org --- drivers/hwtracing/coresight/coresight-etm3x-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c index b670a324bb41..db8413522d72 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -487,7 +487,11 @@ static int etm_enable_perf(struct coresight_device *csdev, return -EBUSY;
/* Configure the tracer based on the session's specifics */ - etm_parse_event_config(drvdata, event); + ret = etm_parse_event_config(drvdata, event); + if (ret) { + coresight_set_mode(csdev, CS_MODE_DISABLED); + return ret; + } drvdata->traceid = path->trace_id;
/* And enable it */