mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i2c: qup: Release DMA channels if interconnect lookup fails
@ 2026-11-05  7:42 Yige Jiang
  2026-11-05  7:56 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: Yige Jiang @ 2026-11-05  7:42 UTC (permalink / raw)
  To: linux-i2c
  Cc: Yige Jiang, Andi Shyti, linux-arm-msm, linux-kernel, Stephan Gerhold

qup_i2c_probe() acquires both BAM DMA channels before getting its
interconnect path. If devm_of_icc_get() fails, the direct return
skips fail_dma and leaks both channels, including when probe is
deferred. A later probe can no longer acquire those channels.

Keep the reported error code and jump to fail_dma to release the
channels. This avoids the clock and MMIO cleanup, which have not
been initialized at this point.

Fixes: d4f35233a634 ("i2c: qup: Vote for interconnect bandwidth to DRAM")
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261102 (2637bdec0535).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y.
COMPILE_TEST=y.
Baseline and patched target objects built from this exact base.
No full kernel/module-link, hardware or runtime test was performed.
AI assistance was used for analysis and patch preparation.

The error needs an interconnect provider failure/defer after DMA setup.
No in-tree QUP I2C DT with the needed interconnects property was identified.

 drivers/i2c/busses/i2c-qup.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index ce30634e1f40..671bc41a5abf 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -1786,9 +1786,11 @@ static int qup_i2c_probe(struct platform_device *pdev)
 		qup->is_dma = true;
 
 		qup->icc_path = devm_of_icc_get(&pdev->dev, NULL);
-		if (IS_ERR(qup->icc_path))
-			return dev_err_probe(&pdev->dev, PTR_ERR(qup->icc_path),
-					     "failed to get interconnect path\n");
+		if (IS_ERR(qup->icc_path)) {
+			ret = dev_err_probe(&pdev->dev, PTR_ERR(qup->icc_path),
+					    "failed to get interconnect path\n");
+			goto fail_dma;
+		}
 	}
 
 nodma:

base-commit: 2637bdec0535a2044cd830eba9a79363651d9043

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: qup: Release DMA channels if interconnect lookup fails
  2026-11-05  7:42 [PATCH] i2c: qup: Release DMA channels if interconnect lookup fails Yige Jiang
@ 2026-11-05  7:56 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-11-05  7:56 UTC (permalink / raw)
  To: Yige Jiang, linux-i2c
  Cc: Andi Shyti, linux-arm-msm, linux-kernel, Stephan Gerhold

On 11/5/26 8:42 AM, Yige Jiang wrote:
> qup_i2c_probe() acquires both BAM DMA channels before getting its
> interconnect path. If devm_of_icc_get() fails, the direct return
> skips fail_dma and leaks both channels, including when probe is
> deferred. A later probe can no longer acquire those channels.
> 
> Keep the reported error code and jump to fail_dma to release the
> channels. This avoids the clock and MMIO cleanup, which have not
> been initialized at this point.
> 
> Fixes: d4f35233a634 ("i2c: qup: Vote for interconnect bandwidth to DRAM")
> Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
> ---

Can se use  devm_dma_request_chan() instead?

Konrad

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-05  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05  7:42 [PATCH] i2c: qup: Release DMA channels if interconnect lookup fails Yige Jiang
2026-11-05  7:56 ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®