diff options
| author | Golla Nagendra <nagendra.golla@amd.com> | 2026-08-14 10:26:09 +0530 |
|---|---|---|
| committer | Vinod Koul <vkoul@kernel.org> | 2026-09-09 19:06:49 +0530 |
| commit | f2f44b952ea6e0c600e92ea21fcaa83cafeedf6e (patch) | |
| tree | 1694224e1678db3a2cfbc81792357c944b2204d8 | |
| parent | 4a1a2d8b8529cc569b769b92fcd71c53805cbeb2 (diff) | |
| download | linux-next-f2f44b952ea6e0c600e92ea21fcaa83cafeedf6e.tar.gz linux-next-f2f44b952ea6e0c600e92ea21fcaa83cafeedf6e.zip | |
dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure
If sw_desc_pool allocation fails after pm_runtime_resume_and_get()
succeeds in zynqmp_dma_alloc_chan_resources(), the error path returns
without dropping the runtime PM reference.
Route that failure path through err_pm so the runtime PM reference is
balanced before returning the error.
Fixes: 8982d48af36d ("dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc()")
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260814045616.1661199-2-nagendra.golla@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
| -rw-r--r-- | drivers/dma/xilinx/zynqmp_dma.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index 2b03584102ac..3a4deab0593c 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -483,8 +483,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) return ret; chan->sw_desc_pool = kzalloc_objs(*desc, ZYNQMP_DMA_NUM_DESCS); - if (!chan->sw_desc_pool) - return -ENOMEM; + if (!chan->sw_desc_pool) { + ret = -ENOMEM; + goto err_pm; + } chan->idle = true; chan->desc_free_cnt = ZYNQMP_DMA_NUM_DESCS; @@ -516,6 +518,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) } return ZYNQMP_DMA_NUM_DESCS; + +err_pm: + pm_runtime_put_autosuspend(chan->dev); + return ret; } /** |
