Re: [PATCH v1] dmaengine: qcom: gpi: Fix channel cleanup in unwind path
From: Mukesh Savaliya
Date: Fri Aug 07 2026 - 07:46:49 EST
On 8/3/2026 5:33 PM, Aniket Randive wrote:
Fix three issues in the gpi_ch_init() error path.start here mentioning the three problems first in generic way.
Use the indexed channel in the error_start_chan and
error_alloc_chan unwind loops instead of the original gchan
pointer. Otherwise, each iteration operates on the same channel,
leaving sibling channels unreset and undeallocated on failure.
meaning, channel cleanup not happened ? make it simpler anyway.
Looking at your change, it looks we are cleaning up gpii iterating over each channel along with setting proper state. Code seems simpler than the commit log, so request you to simplify.
Clear pm_state after freeing the event ring in the error path.
gpi_alloc_ev_chan() sets pm_state to ACTIVE_STATE, but the error
path frees ev_ring without restoring pm_state. As a result,
gpi_free_chan_resources() may attempt to deallocate an already
freed event ring and issue a redundant EV_CMD_DEALLOC.
Also free ch_ring in gpi_alloc_chan_resources() if gpi_ch_init()
fails. The ring is allocated before calling gpi_ch_init(), so a
failure leaves it leaked without this free.
Fix all three issues by unwinding the correct channels, restoring
pm_state to DISABLE_STATE after freeing the event ring, and freeing
ch_ring on gpi_ch_init() failure.
Signed-off-by: Aniket Randive <aniket.randive@xxxxxxxxxxxxxxxx>
---
drivers/dma/qcom/gpi.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c
[...]