diff options
| author | Carlos Song <carlos.song@nxp.com> | 2026-05-20 17:33:23 +0800 |
|---|---|---|
| committer | Andi Shyti <andi.shyti@kernel.org> | 2026-06-09 10:13:09 +0200 |
| commit | 695fcefd4a81466ef9c529790b4e96f1ea2ba051 (patch) | |
| tree | 86ef8f290354ab81fc5ffa8742c3ccfc1e313978 /include/uapi/linux | |
| parent | 656646b3847ac6a21b074a813223feef2aadd6e2 (diff) | |
i2c: imx-lpi2c: fix resource leaks switching to devm_dma_request_chan()
The LPI2C driver requests DMA channels using dma_request_chan(), but
never releases them in lpi2c_imx_remove(), resulting in DMA channel
leaks every time the driver is unloaded.
Additionally, when lpi2c_dma_init() successfully requests the TX DMA
channel but fails to request the RX DMA channel, the probe falls back
to PIO mode and completes successfully. Since probe succeeds, the devres
framework will not trigger any cleanup, leaving the TX DMA channel and
the memory allocated for the dma structure held for the lifetime of the
device even though DMA is never used.
Switch to devm_dma_request_chan() to let the device core manage DMA
channel lifetime automatically. Wrap all allocations within a devres
group so that devres_release_group() can release all partially acquired
resources when DMA init fails and probe continues in PIO mode.
Fixes: a09c8b3f9047 ("i2c: imx-lpi2c: add eDMA mode support for LPI2C")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Cc: <stable@vger.kernel.org> # v6.14+
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260520093323.2882070-1-carlos.song@oss.nxp.com
Diffstat (limited to 'include/uapi/linux')
0 files changed, 0 insertions, 0 deletions
