Re: [PATCH v2 01/11] dmaengine: pl08x: Defer OF DMA controller registration until slave setup
From: Frank Li
Date: Tue Nov 17 2026 - 14:37:41 EST
On Tue, Nov 17, 2026 at 04:37:02PM +0000, Lee Jones wrote:
> pl08x_of_probe() registers the controller with
> of_dma_controller_register() before pl08x_dma_init_virtual_channels()
> initialises the slave channels list and before
> dma_async_device_register() registers the slave DMA device, and
> pl08x_probe() does not unregister the OF DMA controller if subsequent
> initialisation fails.
>
> Move of_dma_controller_register() after dma_async_device_register() for
> the slave device and unwind slave device registration if OF controller
> registration fails.
>
> Fixes: aa4734da6674 ("dmaengine: pl08x: support dt channel assignment")
> Closes: https://sashiko.dev/#/bug/linux-4e233fb9-3b0c-4442-b601-c6706c9f5aba
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> ---
>
> v1 => v2: No changes
>
> drivers/dma/amba-pl08x.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
> index 543c2eb8cfa8..d8441e338502 100644
> --- a/drivers/dma/amba-pl08x.c
> +++ b/drivers/dma/amba-pl08x.c
> @@ -2678,6 +2678,12 @@ static int pl08x_of_probe(struct amba_device *adev,
>
> pl08x->pd = pd;
>
> + return 0;
> +}
> +
> +static int pl08x_of_register(struct amba_device *adev,
> + struct pl08x_driver_data *pl08x)
> +{
> return of_dma_controller_register(adev->dev.of_node, pl08x_of_xlate,
> pl08x);
> }
> @@ -2688,6 +2694,12 @@ static inline int pl08x_of_probe(struct amba_device *adev,
> {
> return -EINVAL;
> }
> +
> +static inline int pl08x_of_register(struct amba_device *adev,
> + struct pl08x_driver_data *pl08x)
> +{
> + return 0;
> +}
> #endif
>
> static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
> @@ -2944,6 +2956,15 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
> __func__, ret);
> goto out_no_slave_reg;
> }
> + if (np) {
> + ret = pl08x_of_register(adev, pl08x);
> + if (ret) {
> + dev_warn(&pl08x->adev->dev,
> + "%s failed to register OF DMA controller - %d\n",
> + __func__, ret);
> + goto out_no_of_dma;
> + }
> + }
> }
>
> amba_set_drvdata(adev, pl08x);
> @@ -2954,6 +2975,8 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
>
> return 0;
>
> +out_no_of_dma:
> + dma_async_device_unregister(&pl08x->slave);
> out_no_slave_reg:
> dma_async_device_unregister(&pl08x->memcpy);
It'd better switch to dmaenginem_async_device_register()
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> out_no_memcpy_reg:
> --
> 2.56.0.679.gc527c65306-goog
>