Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yemike Abhilash Chandra" <y-abhilashchandra@ti.com>
Cc: robh@kernel.org, conor+dt@kernel.org, Frank.Li@kernel.org,
	imx@lists.linux.dev, devicetree@vger.kernel.org
Subject: Re: [PATCH 06/18] arm64: dts: ti: k3-j722s-main: Add multiple channels for CSI2RX DMA
Date: Thu, 02 Jul 2026 09:47:47 +0000	[thread overview]
Message-ID: <20260702094748.45E391F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260702093123.1048575-7-y-abhilashchandra@ti.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] DMA channel leak in ti_csi2rx_runtime_resume() on error path.
- [High] DMA channel leak in ti_csi2rx_probe() on context initialization failure.
--

commit 93bee806331f1aba1613005a42f8e9a3e3a302f3
Author: Vaishnav Achath <vaishnav.a@ti.com>

arm64: dts: ti: k3-j722s-main: Add multiple channels for CSI2RX DMA

This commit adds additional DMA channels to the J721E CSI2RX SHIM layer to
enable multistream support for CSI2RX. It increases the number of DMA channels
per node from one to four.

> diff --git a/arch/arm64/boot/dts/ti/k3-j722s-main.dtsi b/arch/arm64/boot/dts/ti/k3-j722s-main.dtsi
> index 5a5b9a1bfd9ea..199c8652bcde2 100644
> --- a/arch/arm64/boot/dts/ti/k3-j722s-main.dtsi
> +++ b/arch/arm64/boot/dts/ti/k3-j722s-main.dtsi
> @@ -173,8 +173,9 @@ ti_csi2rx1: ticsi2rx@30122000 {
>  		ranges;
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> -		dmas = <&main_bcdma_csi 0 0x5100 0>;
> -		dma-names = "rx0";
> +		dmas = <&main_bcdma_csi 0 0x5100 0>, <&main_bcdma_csi 0 0x5101 0>,
> +		       <&main_bcdma_csi 0 0x5102 0>, <&main_bcdma_csi 0 0x5103 0>;
> +		dma-names = "rx0", "rx1", "rx2", "rx3";

[Severity: High]
This isn't a bug introduced by this patch, but adding multiple DMA channels
exposes a dormant hardware DMA channel leak in the CSI2RX driver.

If ti_csi2rx_init_dma() fails for a context where i > 0 during runtime resume,
the function returns immediately without releasing the channels requested in
earlier loop iterations:

j721e-csi2rx.c:ti_csi2rx_runtime_resume() {
	for (unsigned int i = 0; i < csi->num_ctx; i++) {
		ret = ti_csi2rx_init_dma(&csi->ctx[i]);
		if (ret)
			return ret;
	}
	...
}

Does this code need an error path to release the successfully requested
channels when a subsequent iteration fails?

[Severity: High]
This is a pre-existing issue, but increasing the number of DMA channels here
also exposes another channel leak in the probe error path.

If ti_csi2rx_init_ctx() fails for a context i > 0, the driver attempts to
clean up previous contexts:

j721e-csi2rx.c:ti_csi2rx_probe() {
	for (i = 0; i < csi->num_ctx; i++) {
		csi->ctx[i].idx = i;
		csi->ctx[i].csi = csi;
		ret = ti_csi2rx_init_ctx(&csi->ctx[i]);
		if (ret)
			goto err_ctx;
	}
	...
}

However, the cleanup skips releasing the channel because the device's PM
runtime status is still suspended:

j721e-csi2rx.c:ti_csi2rx_cleanup_ctx() {
	if (!pm_runtime_status_suspended(ctx->csi->dev))
		dma_release_channel(ctx->dma.chan);
	...
}

Since pm_runtime_set_active() hasn't been called yet during early probe, the
condition prevents dma_release_channel() from being executed. Could this
permanently leak the previously initialized hardware DMA channels?

>  		power-domains = <&k3_pds 247 TI_SCI_PD_EXCLUSIVE>;
>  		status = "disabled";

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260702093123.1048575-1-y-abhilashchandra@ti.com?part=6

  reply	other threads:[~2026-07-02  9:47 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02  9:31 [PATCH 00/18] Add DT support for CSI2RX multi-stream Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 01/18] arm64: dts: ti: k3-{j721e/j721s2}-main: Fix indentation in CSI2RX node Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 02/18] arm64: dts: ti: k3-j721e-main: Add multiple channels for CSI2RX DMA Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 03/18] arm64: dts: ti: k3-j721s2-main: " Yemike Abhilash Chandra
2026-07-02  9:55   ` sashiko-bot
2026-07-02  9:31 ` [PATCH 04/18] arm64: dts: ti: k3-j784s4-j742s2-main-common: " Yemike Abhilash Chandra
2026-07-02  9:46   ` sashiko-bot
2026-07-02  9:31 ` [PATCH 05/18] arm64: dts: ti: k3-am62p-j722s: " Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 06/18] arm64: dts: ti: k3-j722s-main: " Yemike Abhilash Chandra
2026-07-02  9:47   ` sashiko-bot [this message]
2026-07-02  9:31 ` [PATCH 07/18] arm64: dts: ti: k3-j721e: Add overlay for fusion application daughter board Yemike Abhilash Chandra
2026-07-02  9:47   ` sashiko-bot
2026-07-02  9:31 ` [PATCH 08/18] arm64: dts: ti: k3-j721s2: " Yemike Abhilash Chandra
2026-07-02  9:45   ` sashiko-bot
2026-07-02  9:31 ` [PATCH 09/18] arm64: dts: ti: k3-j721e-sk: " Yemike Abhilash Chandra
2026-07-02  9:50   ` sashiko-bot
2026-07-02  9:31 ` [PATCH 10/18] arm64: dts: ti: k3-j722s-evm: " Yemike Abhilash Chandra
2026-07-02  9:48   ` sashiko-bot
2026-07-02  9:31 ` [PATCH 11/18] arm64: dts: ti: k3-am68-sk: Add overlay for dual Arducam V3link fusion Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 12/18] arm64: dts: ti: k3-j722s-evm: " Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 13/18] arm64: dts: ti: k3-j784s4-evm: Add overlay for J7EXPA01EVM Fusion2 Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 14/18] arm64: dts: ti: k3-j722s-evm: " Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 15/18] arm64: dts: ti: k3-j721s2: Add overlay for DS90UB954-Q1EVM Yemike Abhilash Chandra
2026-07-02  9:55   ` sashiko-bot
2026-07-02  9:31 ` [PATCH 16/18] arm64: dts: ti: k3-j721e: " Yemike Abhilash Chandra
2026-07-02  9:31 ` [PATCH 17/18] arm64: dts: ti: k3-v3link: Add overlay for IMX219+UB953 serializer Yemike Abhilash Chandra
2026-07-02 10:04   ` sashiko-bot
2026-07-02  9:31 ` [PATCH 18/18] arm64: defconfig: Enable DS90UB960 deserializer and DS90UB953 serializer Yemike Abhilash Chandra
2026-07-02 10:54   ` Krzysztof Kozlowski

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=20260702094748.45E391F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=y-abhilashchandra@ti.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