Re: [PATCH] dma: jz4780: handle clk_prepare_enable() failure in probe

Frank Li <[email protected]>
Newsgroups org.kernel.vger.linux-mips,org.kernel.vger.dmaengine,org.kernel.vger.linux-kernel
Message-ID <aoSIC1r-xAelQ9s1@SMW015318>
On Tue, Aug 18, 2026 at 04:41:31PM +0400, Jiawen Liu wrote:
> From: jiawen <[email protected]>

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 <[email protected]>
> ---
> 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",
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.