[PATCH v2 7/8] coresight: Do not mix success path with failure handling
Leo Yan
leo.yan at arm.com
Mon Jan 26 05:52:07 PST 2026
Separate the failure handling path from the successful case. Use the
'out_unlock' label only for failure handling.
Signed-off-by: Leo Yan <leo.yan at arm.com>
---
drivers/hwtracing/coresight/coresight-core.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index 5c29f78de7f115d61f550dea62b6538940ec9182..c2b5a6efd1c01b0fbfbc289cf27232ccc731ba34 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1395,17 +1395,22 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
registered = true;
ret = coresight_create_conns_sysfs_group(csdev);
- if (!ret)
- ret = coresight_fixup_orphan_conns(csdev);
+ if (ret)
+ goto out_unlock;
+
+ ret = coresight_fixup_orphan_conns(csdev);
+ if (ret)
+ goto out_unlock;
+
+ mutex_unlock(&coresight_mutex);
+
+ if (cti_assoc_ops && cti_assoc_ops->add)
+ cti_assoc_ops->add(csdev);
+
+ return csdev;
out_unlock:
mutex_unlock(&coresight_mutex);
- /* Success */
- if (!ret) {
- if (cti_assoc_ops && cti_assoc_ops->add)
- cti_assoc_ops->add(csdev);
- return csdev;
- }
/* Unregister the device if needed */
if (registered) {
--
2.34.1
More information about the linux-arm-kernel
mailing list