[PATCH 2/9] coresight: etm4x: Remove perf symlink if config registration fails

From: James Clark

Date: Tue Oct 27 2026 - 10:58:32 EST


If etm4_cscfg_register() fails, the perf symlink created just before it
is left behind in the etm_pmu device's directory. Remove it in the same
way as etm4_remove_dev() does.

Fixes: 810ac401db1f ("coresight: etm4x: Add complex configuration handlers to etmv4")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://sashiko.dev/#/bug/linux-5a385158-37fb-48f1-a8c7-28e86e07848a
Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
---
drivers/hwtracing/coresight/coresight-etm4x-core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
index e21be6468e95..ba21fe12870b 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
@@ -2258,6 +2258,7 @@ static int etm4_add_coresight_dev(struct etm4_init_arg *init_arg)
/* register with config infrastructure & load any current features */
ret = etm4_cscfg_register(drvdata->csdev);
if (ret) {
+ etm_perf_symlink(drvdata->csdev, false);
coresight_unregister(drvdata->csdev);
return ret;
}

--
2.43.0