[PATCH v4 8/8] coresight: Unify bus unregistration via coresight_unregister()

Leo Yan leo.yan at arm.com
Mon Feb 9 04:44:40 PST 2026


Once a device is successfully registered, set the "registered" flag to
true.  After that point, all failures jump to the out_unlock label to
unwind the flow via coresight_unregister().

Since failure handling is unified, the comment about resource release
for the etm_perf_add_symlink_sink() failure is no need, remove it.

Signed-off-by: Leo Yan <leo.yan at arm.com>
---
 drivers/hwtracing/coresight/coresight-core.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index 955af43010446803030973c72f07315492b2fcf3..56320ce49cb23bf7168f69b7f1ad820ca83b8365 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1383,20 +1383,13 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
 		goto out_unlock;
 	}
 
-	ret = etm_perf_add_symlink_sink(csdev);
-
-	/*
-	 * As with the above, all resources are free'd explicitly via
-	 * coresight_device_release() triggered from put_device(), which is in
-	 * turn called from function device_unregister().
-	 */
-	if (ret && ret != -EOPNOTSUPP) {
-		device_unregister(&csdev->dev);
-		goto out_unlock;
-	}
 	/* Device is now registered */
 	registered = true;
 
+	ret = etm_perf_add_symlink_sink(csdev);
+	if (ret && ret != -EOPNOTSUPP)
+		goto out_unlock;
+
 	ret = coresight_create_conns_sysfs_group(csdev);
 	if (ret)
 		goto out_unlock;

-- 
2.34.1




More information about the linux-arm-kernel mailing list