Re: [PATCH v2 2/4] dmaengine: dma-axi-dmac: Properly free struct axi_dmac_desc

Frank Li
2026-03-30T15:17:21Z

On Fri, Mar 27, 2026 at 04:58:39PM +0000, Nuno Sá wrote:
> In axi_dmac_prep_peripheral_dma_vec() if we fail after calling
> axi_dmac_alloc_desc(), we need to use axi_dmac_free_desc() to fully free
> the descriptor.

Call axi_dmac_free_desc() instead of kfree() to do fully cleanup at err
handle path.

Frank

>
> Fixes: 74609e568670 ("dmaengine: dma-axi-dmac: Implement device_prep_peripheral_dma_vec")
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> ---
> drivers/dma/dma-axi-dmac.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> index 45c2c8e4bc45..127c3cf80a0e 100644
> --- a/drivers/dma/dma-axi-dmac.c
> +++ b/drivers/dma/dma-axi-dmac.c
> @@ -769,7 +769,7 @@ axi_dmac_prep_peripheral_dma_vec(struct dma_chan *c, const struct dma_vec *vecs,
> for (i = 0; i < nb; i++) {
> if (!axi_dmac_check_addr(chan, vecs[i].addr) ||
> !axi_dmac_check_len(chan, vecs[i].len)) {
> - kfree(desc);
> + axi_dmac_free_desc(desc);
> return NULL;
> }
>
>
> --
> 2.53.0
>