From: Yige Jiang <yigejiang86@gmail.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Yige Jiang <yigejiang86@gmail.com>,
Mike Leach <mike.leach@arm.com>,
James Clark <james.clark@linaro.org>, Leo Yan <leo.yan@arm.com>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/3] coresight: tpdm: Fix fwnode reference leak on probe failure
Date: Thu, 26 Nov 2026 23:57:02 +0800 [thread overview]
Message-ID: <20261126-coresight-v2-58e559131f2f@gmail.com> (raw)
coresight_get_platform_data() takes a reference to the destination
firmware node of each output connection. The core drops those references
on registration failure or when the device is unregistered. Device
resource cleanup alone does not release them.
tpdm_probe() can return before registration if driver data allocation,
MMIO mapping, dataset setup or device name allocation fails. Move the
platform data lookup after these steps so every successful lookup
reaches coresight_register().
Static analysis flagged the TPDM error paths. Codex helped prepare the
change and describe how the references are released.
Fixes: b3c71626a933 ("Coresight: Add coresight TPDM source driver")
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
v2: Rebase the TPDM fix on the CoreSight next tree. Add separate
fixes for TNOC and TPDA following review of v1.
v1: https://lore.kernel.org/all/rc-b1-20261110-vc-178-2d9055f946c8@gmail.com/
Review: https://lore.kernel.org/all/e06bd559-c8c5-4e82-8951-9f7894cfb378@linaro.org/
Compile-tested: arm64, GCC 14.2.0, W=1, coresight-tpdm.o.
The baseline and patched objects built without warnings.
No hardware or runtime tests were performed.
drivers/hwtracing/coresight/coresight-tpdm.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
index 8464edbba2d45efa5ba041dae70149a946c20465..f4b879bfca1a153f50012757e1b078605fa87944 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.c
+++ b/drivers/hwtracing/coresight/coresight-tpdm.c
@@ -1408,11 +1408,6 @@ static int tpdm_probe(struct device *dev, struct resource *res)
struct coresight_desc desc = { 0 };
int ret;
- pdata = coresight_get_platform_data(dev);
- if (IS_ERR(pdata))
- return PTR_ERR(pdata);
- dev->platform_data = pdata;
-
/* driver data*/
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
@@ -1448,6 +1443,12 @@ static int tpdm_probe(struct device *dev, struct resource *res)
desc.name = coresight_alloc_device_name("tpdm", dev);
if (!desc.name)
return -ENOMEM;
+
+ pdata = coresight_get_platform_data(dev);
+ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
+ dev->platform_data = pdata;
+
desc.type = CORESIGHT_DEV_TYPE_SOURCE;
desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM;
desc.ops = &tpdm_cs_ops;
base-commit: b7d7462c7f973b65de511db6bebb99fb29946ed8
reply other threads:[~2026-11-26 15:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126-coresight-v2-58e559131f2f@gmail.com \
--to=yigejiang86@gmail.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@arm.com \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox