From: Frank Li <Frank.li@oss.nxp.com>
To: Chaithanya Lagisetty <nagachaithanya9911@gmail.com>
Cc: Vinod Koul <vkoul@kernel.org>, Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Frank Li <Frank.Li@kernel.org>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: sprd: fix clock imbalance when enabling ashb_clk fails
Date: Thu, 13 Aug 2026 11:39:12 -0500 [thread overview]
Message-ID: <an3zMHoaxx4XzvpK@SMW015318> (raw)
In-Reply-To: <20260813105354.2577040-1-nagachaithanya9911@gmail.com>
On Thu, Aug 13, 2026 at 10:53:54AM +0000, Chaithanya Lagisetty wrote:
> [You don't often get email from nagachaithanya9911@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> sprd_dma_enable() enables sdev->clk and then enables the optional
> ashb_clk. If clk_prepare_enable() for ashb_clk fails, the function
> returns the error without disabling sdev->clk, which was already
> enabled. Both callers (probe and resume) treat a non-zero return as
> "nothing was enabled" and bail out, so sdev->clk is leaked.
>
> Disable sdev->clk on the ashb_clk enable failure path.
>
> Fixes: 9b3b8171f7f4 ("dmaengine: sprd: Add Spreadtrum DMA driver")
> Signed-off-by: Chaithanya Lagisetty <nagachaithanya9911@gmail.com>
> ---
> drivers/dma/sprd-dma.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index 087fea3af2e4..3ea5c3ba1a8c 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -270,9 +270,16 @@ static int sprd_dma_enable(struct sprd_dma_dev *sdev)
> * The ashb_clk is optional and only for AGCP DMA controller, so we
> * need add one condition to check if the ashb_clk need enable.
> */
> - if (!IS_ERR(sdev->ashb_clk))
> + if (!IS_ERR(sdev->ashb_clk)) {
> ret = clk_prepare_enable(sdev->ashb_clk);
> + if (ret)
> + goto disable_clk;
> + }
>
> + return 0;
> +
> +disable_clk:
> + clk_disable_unprepare(sdev->clk);
Convert to clk bulk API.
Frank
> return ret;
> }
>
> --
> 2.43.0
>
prev parent reply other threads:[~2026-08-13 16:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 10:53 [PATCH] dmaengine: sprd: fix clock imbalance when enabling ashb_clk fails Chaithanya Lagisetty
2026-08-13 11:06 ` sashiko-bot
2026-08-13 16:39 ` Frank Li [this message]
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=an3zMHoaxx4XzvpK@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nagachaithanya9911@gmail.com \
--cc=orsonzhai@gmail.com \
--cc=vkoul@kernel.org \
--cc=zhang.lyra@gmail.com \
/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