diff options
| author | Hongjian Dai <daihongjian@kylinsec.com.cn> | 2026-09-30 00:43:40 +0800 |
|---|---|---|
| committer | Andi Shyti <andi.shyti@kernel.org> | 2026-10-01 13:51:54 +0200 |
| commit | c98bf3b86609a18ab16d067280257326e557c636 (patch) | |
| tree | eb6432da9d1b1e2e1005027ff641ef6563663acb | |
| parent | 840d8acc87925deb3c75566fde9ca81d2f47f98c (diff) | |
| download | linux-stable-c98bf3b86609a18ab16d067280257326e557c636.tar.gz linux-stable-c98bf3b86609a18ab16d067280257326e557c636.zip | |
i2c: at91: release DMA channels when probe defers
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>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/7D85C6CB6BF0A82E+20260929164340.41628-1-daihongjian@kylinsec.com.cn
| -rw-r--r-- | drivers/i2c/busses/i2c-at91-master.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c index 68238cc8a..e0c3de5e8 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; |
