DMA Engine development
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@gmail.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	dan.j.williams@intel.com, vkoul@kernel.org
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path
Date: Mon, 25 Jan 2021 13:13:26 +0200	[thread overview]
Message-ID: <f0b99332-fcac-093a-5f9e-997c9955ad7c@gmail.com> (raw)
In-Reply-To: <20210124070923.724479-1-christophe.jaillet@wanadoo.fr>

Hi,

On 1/24/21 9:09 AM, Christophe JAILLET wrote:
> In 'dma_pool_create()', we return -ENOMEM, but don't release the resources
> already allocated, as in all the other error handling paths.
> 
> Go to 'err_res_free' instead of returning directly.

Interesting that I only had error for the bcdma path...

> Fixes: 017794739702 ("dmaengine: ti: k3-udma: Initial support for K3 BCDMA")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is not even compile tested.
> I don't have the needed configuration.

No issue, that patch is trivial,

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> ---
>   drivers/dma/ti/k3-udma.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 8e3fd1119a77..96ad21869ba7 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -2447,7 +2447,8 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
>   			dev_err(ud->ddev.dev,
>   				"Descriptor pool allocation failed\n");
>   			uc->use_dma_pool = false;
> -			return -ENOMEM;
> +			ret = -ENOMEM;
> +			goto err_res_free;
>   		}
>   
>   		uc->use_dma_pool = true;
> 

-- 
Péter

  reply	other threads:[~2021-01-26 17:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24  7:09 [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path Christophe JAILLET
2021-01-25 11:13 ` Péter Ujfalusi [this message]
2021-01-26 17:32 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f0b99332-fcac-093a-5f9e-997c9955ad7c@gmail.com \
    --to=peter.ujfalusi@gmail.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox