milos-linux/drivers/i2c
Carlos Song 695fcefd4a
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: a09c8b3f90 ("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
2026-06-09 10:13:09 +02:00
..
algos i2c: pcf8584: Change pcf_doAdress() to pcf_send_address() 2025-10-28 17:05:39 +01:00
busses i2c: imx-lpi2c: fix resource leaks switching to devm_dma_request_chan() 2026-06-09 10:13:09 +02:00
muxes i2c: muxes: pca954x: Fix broken reset-gpio usage 2025-11-03 18:04:15 +01:00
i2c-atr.c i2c: atr: use kzalloc_flex 2026-04-10 01:16:59 +02:00
i2c-boardinfo.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-core-acpi.c i2c: acpi: Add ELAN0678 to i2c_acpi_force_100khz_device_ids 2026-05-04 11:17:46 +02:00
i2c-core-base.c i2c: Compare the return value of gpiod_get_direction against GPIO_LINE_DIRECTION_OUT 2026-05-04 12:19:25 +02:00
i2c-core-of-prober.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-core-of.c device property: Make modifications of fwnode "flags" thread safe 2026-03-26 22:00:59 +01:00
i2c-core-slave.c i2c: Use trace_call__##name() at guarded tracepoint call sites 2026-03-26 10:24:39 -04:00
i2c-core-smbus.c i2c: smbus: fix a potential uninitialization bug 2026-05-19 12:43:08 +02:00
i2c-core.h
i2c-dev.c i2c: dev: prevent integer overflow in I2C_TIMEOUT ioctl 2026-05-04 11:31:35 +02:00
i2c-mux.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-slave-eeprom.c sysfs: treewide: switch back to bin_attribute::read()/write() 2025-06-17 10:44:13 +02:00
i2c-slave-testunit.c i2c: testunit: Replace system_long_wq with system_dfl_long_wq 2026-05-04 10:07:46 +02:00
i2c-smbus.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
i2c-stub.c i2c: stub: Reject I2C block transfers with invalid length 2026-05-04 13:23:53 +02:00
Kconfig
Makefile