[PATCH] dmaengine: at_hdmac: ioremap and get irq early

Frank Li Frank.li at oss.nxp.com
Wed Aug 19 12:50:49 PDT 2026


On Wed, Jul 22, 2026 at 10:06:06PM -0700, Rosen Penev wrote:
> The functions can return -EPROBE_DEFER. Call them before anything else
> to avoid doing extra work.

just move before one devm_kalloc(), I have not seen much beanfit for it.

Frank

>
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>  drivers/dma/at_hdmac.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e5b30a57c477..2f6f5877fc3c 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1943,11 +1943,20 @@ static void at_dma_off(struct at_dma *atdma)
>  static int __init at_dma_probe(struct platform_device *pdev)
>  {
>  	struct at_dma		*atdma;
> +	void __iomem		*regs;
>  	int			irq;
>  	int			err;
>  	int			i;
>  	const struct at_dma_platform_data *plat_dat;
>
> +	regs = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(regs))
> +		return PTR_ERR(regs);
> +
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq < 0)
> +		return irq;
> +
>  	/* setup platform data for each SoC */
>  	dma_cap_set(DMA_MEMCPY, at91sam9rl_config.cap_mask);
>  	dma_cap_set(DMA_INTERLEAVE, at91sam9g45_config.cap_mask);
> @@ -1968,13 +1977,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  	if (!atdma)
>  		return -ENOMEM;
>
> -	atdma->regs = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(atdma->regs))
> -		return PTR_ERR(atdma->regs);
> -
> -	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0)
> -		return irq;
> +	atdma->regs = regs;
>
>  	/* discover transaction capabilities */
>  	atdma->dma_device.cap_mask = plat_dat->cap_mask;
> --
> 2.55.0
>



More information about the linux-arm-kernel mailing list