From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F6543783C0 for ; Mon, 9 Feb 2026 12:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770641107; cv=none; b=UYi5rZrka9QHT+6odzLjIrPOABkRwLi/mR65o2Adnwx8bVycR9ERz0f7otNbLIPVknaC4fb+cbj/b0GVnv2P36gcpAeq+DHdaO4tKHXwAPwIWXSkWbk3H0/rD6g6F6sP3VGm9Gl92F2SYvPyRz02xd4s9tbrGtguZbBIYEbnXVc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770641107; c=relaxed/simple; bh=ySxXMDurtX6pTacsLYOzBNYEPNJzboemPr3jVVpf8qM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gP+tbmVESaTWSWEZTzil6dTxj7dfL31NgTl/O6pM3zfWwMBLdcBplmqGgB8fPE6XCx539eB044hp7DIcigXUqWIHFQLo5Xzfwp1wscomDpb2D04XWoq1Zsd1w+yFj5Lq9B/Wnxyul+ljpoFG11ALj4hu21B5Re3OsJUOTRrio0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6C5AE339; Mon, 9 Feb 2026 04:45:00 -0800 (PST) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 105FE3F63F; Mon, 9 Feb 2026 04:45:04 -0800 (PST) From: Leo Yan Date: Mon, 09 Feb 2026 12:44:39 +0000 Subject: [PATCH v4 7/8] coresight: Do not mix success path with failure handling Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260209-arm_coresight_refactor_dev_register-v4-7-62d6042f76f7@arm.com> References: <20260209-arm_coresight_refactor_dev_register-v4-0-62d6042f76f7@arm.com> In-Reply-To: <20260209-arm_coresight_refactor_dev_register-v4-0-62d6042f76f7@arm.com> To: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Greg Kroah-Hartman , Mathieu Poirier , Mao Jinlong Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770641090; l=1402; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=ySxXMDurtX6pTacsLYOzBNYEPNJzboemPr3jVVpf8qM=; b=aDjFFP4dsoVyeBGagPB69BmdNgG+XVGmZo40ZRKsxoO7ID2tAcnbZCO/bm+zF4V7G7pouq8Q2 hsMwjvg4UHYD528vfQunvTvkzN+sOd+Dq+1jWU6ssUE3e5vXDeNFrRM X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= Separate the failure handling path from the successful case. Use the 'out_unlock' label only for failure handling. Reviewed-by: James Clark Signed-off-by: Leo Yan --- 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