Re: [PATCH] dmaengine: jz4780: handle clock enable failures

From: H. Nikolaus Schaller

Date: Sun Nov 29 2026 - 09:51:16 EST


Hi,

> Am 29.11.2026 um 13:53 schrieb Jiawen Liu <1298662399@xxxxxx>:
>
> jz4780_dma_probe() ignores the result of clk_prepare_enable() and
> continues to configure controller registers, request resources, and
> register the DMA controller. A parent-clock failure can therefore publish
> a controller without a successful clock activation. Later probe cleanup
> can also attempt to disable a clock that was never enabled.
>
> Propagate the activation error before touching the controller.
>
> Fixes: d894fc6046fe ("dmaengine: jz4780: add driver for the Ingenic JZ4780 DMA controller")
> Signed-off-by: Jiawen Liu <1298662399@xxxxxx>
> ---
> drivers/dma/dma-jz4780.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
> index e610aba094188..c1438bf3336b0 100644
> --- a/drivers/dma/dma-jz4780.c
> +++ b/drivers/dma/dma-jz4780.c
> @@ -902,7 +902,9 @@ static int jz4780_dma_probe(struct platform_device *pdev)
> return ret;
> }
>
> - clk_prepare_enable(jzdma->clk);
> + ret = clk_prepare_enable(jzdma->clk);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to enable clock\n");
>
> /* Property is optional, if it doesn't exist the value will remain 0. */
> of_property_read_u32_index(dev->of_node, "ingenic,reserved-channels",
> --
> 2.34.1
>
>

there seems to be a patch for a related problem from 2025:

https://linuxtesting.org/pipermail/lvc-project/2025-January/003978.html

It was acked by Paul but I could not find it upstream.

BR,
Nikolaus