* [PATCH] dma: jz4780: handle clk_prepare_enable() failure in probe
@ 2026-08-18 12:41 Jiawen Liu
2026-08-18 16:27 ` Frank Li
2026-08-19 15:32 ` Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: Jiawen Liu @ 2026-08-18 12:41 UTC (permalink / raw)
To: Paul Cercueil, Vinod Koul, linux-mips, dmaengine, linux-kernel
Cc: Frank Li, jiawen
From: jiawen <1298662399@qq.com>
jz4780_dma_probe() ignores the return value of clk_prepare_enable(). If
the clock fails to enable, the driver continues and may later attempt to
disable an unprepared clock on error paths, leading to unbalanced clock
operations.
Check the return value and propagate the error immediately, avoiding the
erroneous cleanup.
Signed-off-by: jiawen <1298662399@qq.com>
---
diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -903,7 +903,9 @@
return ret;
}
- clk_prepare_enable(jzdma->clk);
+ ret = clk_prepare_enable(jzdma->clk);
+ if (ret)
+ return ret;
/* Property is optional, if it doesn't exist the value will remain 0. */
of_property_read_u32_index(dev->of_node, "ingenic,reserved-channels",
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dma: jz4780: handle clk_prepare_enable() failure in probe
2026-08-18 12:41 [PATCH] dma: jz4780: handle clk_prepare_enable() failure in probe Jiawen Liu
@ 2026-08-18 16:27 ` Frank Li
2026-08-19 15:32 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-08-18 16:27 UTC (permalink / raw)
To: Jiawen Liu
Cc: Paul Cercueil, Vinod Koul, linux-mips, dmaengine, linux-kernel,
Frank Li
On Tue, Aug 18, 2026 at 04:41:31PM +0400, Jiawen Liu wrote:
> From: jiawen <1298662399@qq.com>
subject:
dmaengine: jz4780: propagate the return value of clk_prepare_enable() in probe
Frank
>
> jz4780_dma_probe() ignores the return value of clk_prepare_enable(). If
> the clock fails to enable, the driver continues and may later attempt to
> disable an unprepared clock on error paths, leading to unbalanced clock
> operations.
>
> Check the return value and propagate the error immediately, avoiding the
> erroneous cleanup.
>
> Signed-off-by: jiawen <1298662399@qq.com>
> ---
> diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
> --- a/drivers/dma/dma-jz4780.c
> +++ b/drivers/dma/dma-jz4780.c
> @@ -903,7 +903,9 @@
> return ret;
> }
>
> - clk_prepare_enable(jzdma->clk);
> + ret = clk_prepare_enable(jzdma->clk);
> + if (ret)
> + return ret;
>
> /* Property is optional, if it doesn't exist the value will remain 0. */
> of_property_read_u32_index(dev->of_node, "ingenic,reserved-channels",
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dma: jz4780: handle clk_prepare_enable() failure in probe
2026-08-18 12:41 [PATCH] dma: jz4780: handle clk_prepare_enable() failure in probe Jiawen Liu
2026-08-18 16:27 ` Frank Li
@ 2026-08-19 15:32 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-08-19 15:32 UTC (permalink / raw)
To: 1298662399, dmaengine, linux-mips, Paul Cercueil, Vinod Koul
Cc: LKML, kernel-janitors, Frank Li
…
> Check the return value and propagate the error immediately, avoiding the
> erroneous cleanup.
How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2#n145
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v7.2#n34
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-19 15:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 12:41 [PATCH] dma: jz4780: handle clk_prepare_enable() failure in probe Jiawen Liu
2026-08-18 16:27 ` Frank Li
2026-08-19 15:32 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox