[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9c86b280-60de-4819-855a-87c91f057dcd@arm.com>
Date: Thu, 11 Sep 2025 11:03:06 +0100
From: Suzuki K Poulose <suzuki.poulose@....com>
To: Leo Yan <leo.yan@....com>, Mike Leach <mike.leach@...aro.org>,
James Clark <james.clark@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Mao Jinlong <quic_jinlmao@...cinc.com>, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 4/5] coresight: Separate failure and success flows
On 12/05/2025 16:41, Leo Yan wrote:
> For a success registration, it releases mutex, then binds associated CTI
> device, and returns a device pointer.
>
> As a result, it separates flows between the success case and the failure
> flow, any code after the tag 'out_unlock' is only used for failure
> handling.
>
This description is a bit ambiguous. Please could we simply say:
Subject: coresight: Cleanup coresight_register error handling
Separate the failure handling path from the successful case.
Use the out_unlock label only for the failure handling.
Rest looks fine to me.
Suzuki
> Signed-off-by: Leo Yan <leo.yan@....com>
> ---
> drivers/hwtracing/coresight/coresight-core.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
> index 4f51ce152ac7..4fc82206b326 100644
> --- a/drivers/hwtracing/coresight/coresight-core.c
> +++ b/drivers/hwtracing/coresight/coresight-core.c
> @@ -1377,17 +1377,21 @@ 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) {
Powered by blists - more mailing lists