| Message ID | rc-review-20261105-vc-48-dbf6a486c74f@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | i2c: qup: Release DMA channels if interconnect lookup fails | expand |
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
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:
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(-) base-commit: 2637bdec0535a2044cd830eba9a79363651d9043