[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260209-arm_coresight_refactor_dev_register-v4-7-62d6042f76f7@arm.com>
Date: Mon, 09 Feb 2026 12:44:39 +0000
From: Leo Yan <leo.yan@....com>
To: Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@....com>, James Clark <james.clark@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Mao Jinlong <quic_jinlmao@...cinc.com>
Cc: coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Leo Yan <leo.yan@....com>
Subject: [PATCH v4 7/8] coresight: Do not mix success path with failure
handling
Separate the failure handling path from the successful case. Use the
'out_unlock' label only for failure handling.
Reviewed-by: James Clark <james.clark@...aro.org>
Signed-off-by: Leo Yan <leo.yan@....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 c694b4bea3d724464e97a4932ead584d59d8a69a..955af43010446803030973c72f07315492b2fcf3 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1398,17 +1398,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
Powered by blists - more mailing lists