Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jie Gan" <jie.gan@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 2/5] coresight: tnoc: add AG tnoc standalone compatible to the platform driver
Date: Wed, 01 Jul 2026 02:08:14 +0000	[thread overview]
Message-ID: <20260701020814.B64C41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701-fix-tracenoc-probe-issue-v4-2-aefab449a470@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Unconditional freeing of a negative `atid` in `trace_noc_remove` triggers a WARN.
--

commit eff1528970750559f434d02a9ca2f7e317469aa7
Author: Jie Gan <jie.gan@oss.qualcomm.com>

coresight: tnoc: add AG tnoc standalone compatible to the platform driver

This commit allows the Aggregator TNOC to probe as a platform device by
adding the "qcom,coresight-agtnoc" compatible and updating driver
callbacks to use generic names. It also restricts the ATID-unsupported
handling to the Interconnect TNOC ("qcom,coresight-itnoc") rather than
all non-AMBA devices.

> diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c
> index 9e8de4323d285..4ccd5f38b92a3 100644
> --- a/drivers/hwtracing/coresight/coresight-tnoc.c
> +++ b/drivers/hwtracing/coresight/coresight-tnoc.c
> @@ -130,7 +130,7 @@ static int trace_noc_init_default_data(struct trace_noc_drvdata *drvdata)
>  {
>  	int atid;
>  
> -	if (!dev_is_amba(drvdata->dev)) {
> +	if (of_device_is_compatible(drvdata->dev->of_node, "qcom,coresight-itnoc")) {
>  		drvdata->atid = -EOPNOTSUPP;
>  		return 0;
>  	}

[Severity: Medium]
If a malformed device tree uses compatible = "qcom,coresight-itnoc",
"arm,primecell"; the device will bind to the AMBA driver, and this new
check will assign drvdata->atid = -EOPNOTSUPP.

When the device unbinds, trace_noc_remove() will execute:

drivers/hwtracing/coresight/coresight-tnoc.c:trace_noc_remove() {
	...
	coresight_unregister(drvdata->csdev);
	coresight_trace_id_put_system_id(drvdata->atid);
}

Since trace_noc_remove() unconditionally passes drvdata->atid to
coresight_trace_id_put_system_id(), will this trigger a kernel WARN in
coresight_trace_id_free() due to the negative ID?

[ ... ]

> @@ -295,16 +295,18 @@ static int itnoc_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static void itnoc_remove(struct platform_device *pdev)
> +static void tnoc_platform_remove(struct platform_device *pdev)
>  {
>  	struct trace_noc_drvdata *drvdata = platform_get_drvdata(pdev);
>  
>  	coresight_unregister(drvdata->csdev);
>  	pm_runtime_disable(&pdev->dev);
> +	if (drvdata->atid > 0)
> +		coresight_trace_id_put_system_id(drvdata->atid);
>  }

[Severity: Medium]
Would it make sense to update trace_noc_remove() to include the same
if (drvdata->atid > 0) defensive check that was correctly added here to
tnoc_platform_remove()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260701-fix-tracenoc-probe-issue-v4-0-aefab449a470@oss.qualcomm.com?part=2

  reply	other threads:[~2026-07-01  2:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  1:53 [PATCH v4 0/5] Fix traceNoC probe issue on multiple QCOM platforms Jie Gan
2026-07-01  1:53 ` [PATCH v4 1/5] dt-bindings: arm: coresight-tnoc: Add standalone qcom,coresight-agtnoc compatible Jie Gan
2026-07-01  6:57   ` Krzysztof Kozlowski
2026-07-01  7:16     ` Jie Gan
2026-07-01  7:26       ` Krzysztof Kozlowski
2026-07-01  7:31         ` Jie Gan
2026-07-01 11:02           ` Konrad Dybcio
2026-07-01 12:54             ` Jie Gan
2026-07-01 13:09               ` Konrad Dybcio
2026-07-01 13:30                 ` Krzysztof Kozlowski
2026-07-02  0:51                   ` Jie Gan
2026-07-01  1:53 ` [PATCH v4 2/5] coresight: tnoc: add AG tnoc standalone compatible to the platform driver Jie Gan
2026-07-01  2:08   ` sashiko-bot [this message]
2026-07-01  6:58   ` Krzysztof Kozlowski
2026-07-01  1:53 ` [PATCH v4 3/5] arm64: dts: qcom: kaanapali: fix traceNoC probe issue Jie Gan
2026-07-01  2:07   ` sashiko-bot
2026-07-01  1:53 ` [PATCH v4 4/5] arm64: dts: qcom: sm8750: " Jie Gan
2026-07-01  2:06   ` sashiko-bot
2026-07-01  1:53 ` [PATCH v4 5/5] arm64: dts: qcom: glymur: use Aggregator TNOC compatible Jie Gan

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=20260701020814.B64C41F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jie.gan@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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