From: Sanjay R Mehta <sanmehta@amd.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Sanjay R Mehta <sanju.mehta@amd.com>,
Vinod Koul <vkoul@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: ptdma: Fix the error handling path in pt_core_init()
Date: Mon, 31 Jan 2022 20:36:37 +0530 [thread overview]
Message-ID: <f1081199-cb12-bac2-7fea-f4d2e4808410@amd.com> (raw)
In-Reply-To: <1b2573cf3cd077494531993239f80c08e7feb39e.1643551909.git.christophe.jaillet@wanadoo.fr>
On 1/30/2022 7:42 PM, Christophe JAILLET wrote:
> In order to free resources correctly in the error handling path of
> pt_core_init(), 2 goto's have to be switched. Otherwise, some resources
> will leak and we will try to release things that have not been allocated
> yet.
>
> Fixes: fa5d823b16a9 ("dmaengine: ptdma: Initial driver for the AMD PTDMA")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Sanjay R Mehta <sanju.mehta@amd.com>
> ---
> drivers/dma/ptdma/ptdma-dev.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/ptdma/ptdma-dev.c b/drivers/dma/ptdma/ptdma-dev.c
> index 8a6bf291a73f..3fa2a6ed4b68 100644
> --- a/drivers/dma/ptdma/ptdma-dev.c
> +++ b/drivers/dma/ptdma/ptdma-dev.c
> @@ -207,7 +207,7 @@ int pt_core_init(struct pt_device *pt)
> if (!cmd_q->qbase) {
> dev_err(dev, "unable to allocate command queue\n");
> ret = -ENOMEM;
> - goto e_dma_alloc;
> + goto e_pool;
> }
>
> cmd_q->qidx = 0;
> @@ -230,7 +230,7 @@ int pt_core_init(struct pt_device *pt)
> /* Request an irq */
> ret = request_irq(pt->pt_irq, pt_core_irq_handler, 0, dev_name(pt->dev), pt);
> if (ret)
> - goto e_pool;
> + goto e_dma_alloc;
>
> /* Update the device registers with queue information. */
> cmd_q->qcontrol &= ~CMD_Q_SIZE;
>
next prev parent reply other threads:[~2022-01-31 15:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-30 14:12 [PATCH] dmaengine: ptdma: Fix the error handling path in pt_core_init() Christophe JAILLET
2022-01-31 15:06 ` Sanjay R Mehta [this message]
2022-02-02 7:15 ` Dan Carpenter
2022-02-02 18:45 ` Christophe JAILLET
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=f1081199-cb12-bac2-7fea-f4d2e4808410@amd.com \
--to=sanmehta@amd.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dmaengine@vger.kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sanju.mehta@amd.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.