* [PATCH] i2c: at91: release DMA channels when probe defers
@ 2026-09-29 16:43 Hongjian Dai
2026-10-01 22:36 ` Andi Shyti
0 siblings, 1 reply; 2+ messages in thread
From: Hongjian Dai @ 2026-09-29 16:43 UTC (permalink / raw)
To: codrin.ciubotariu, andi.shyti, nicolas.ferre, alexandre.belloni,
claudiu.beznea
Cc: linux-i2c, linux-arm-kernel, linux-kernel, me, Hongjian Dai
at91_twi_probe_master() can return -EPROBE_DEFER from
at91_init_twi_recovery_info() after at91_twi_configure_dma() has already
claimed the tx/rx DMA channels. at91_twi_probe() then returns without
releasing them, and since dma_request_chan() is not devres-managed the
channels leak on every deferred probe attempt.
Release the channels before deferring the probe.
Fixes: f7eeb1af8537 ("i2c: at91: release DMA channels on remove and probe error")
Assisted-by: LLM
Signed-off-by: Hongjian Dai <daihongjian@kylinsec.com.cn>
---
drivers/i2c/busses/i2c-at91-master.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c
index 68238cc8aee0..e0c3de5e8203 100644
--- a/drivers/i2c/busses/i2c-at91-master.c
+++ b/drivers/i2c/busses/i2c-at91-master.c
@@ -921,8 +921,14 @@ int at91_twi_probe_master(struct platform_device *pdev,
at91_calc_twi_clock(dev);
rc = at91_init_twi_recovery_info(pdev, dev);
- if (rc == -EPROBE_DEFER)
+ if (rc == -EPROBE_DEFER) {
+ /*
+ * The DMA channels were already set up above, release them
+ * before deferring the probe so they are not leaked.
+ */
+ at91_twi_dma_release(dev);
return rc;
+ }
dev->adapter.algo = &at91_twi_algorithm;
dev->adapter.quirks = &at91_twi_quirks;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: at91: release DMA channels when probe defers
2026-09-29 16:43 [PATCH] i2c: at91: release DMA channels when probe defers Hongjian Dai
@ 2026-10-01 22:36 ` Andi Shyti
0 siblings, 0 replies; 2+ messages in thread
From: Andi Shyti @ 2026-10-01 22:36 UTC (permalink / raw)
To: Hongjian Dai
Cc: codrin.ciubotariu, nicolas.ferre, alexandre.belloni,
claudiu.beznea, linux-i2c, linux-arm-kernel, linux-kernel, me
Hi Hongjian,
On Wed, Sep 30, 2026 at 12:43:40AM +0800, Hongjian Dai wrote:
> at91_twi_probe_master() can return -EPROBE_DEFER from
> at91_init_twi_recovery_info() after at91_twi_configure_dma() has already
> claimed the tx/rx DMA channels. at91_twi_probe() then returns without
> releasing them, and since dma_request_chan() is not devres-managed the
> channels leak on every deferred probe attempt.
>
> Release the channels before deferring the probe.
>
> Fixes: f7eeb1af8537 ("i2c: at91: release DMA channels on remove and probe error")
> Assisted-by: LLM
> Signed-off-by: Hongjian Dai <daihongjian@kylinsec.com.cn>
pushed to i2c/i2c-fixes.
Thanks,
Andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-01 22:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 16:43 [PATCH] i2c: at91: release DMA channels when probe defers Hongjian Dai
2026-10-01 22:36 ` Andi Shyti
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®