Re: [PATCH 08/11] dmaengine: imx-sdma: fix missing of_dma_controller_free()

From: Frank Li
Date: Wed Sep 03 2025 - 11:08:31 EST


On Wed, Sep 03, 2025 at 03:06:16PM +0200, Marco Felsch wrote:
> Add the missing of_dma_controller_free() to free the resources allocated
> via of_dma_controller_register(). The missing free was introduced long
> time ago by commit 23e118113782 ("dma: imx-sdma: use
> module_platform_driver for SDMA driver") while adding a proper .remove()
> implementation.
>
> Fixes: 23e118113782 ("dma: imx-sdma: use module_platform_driver for SDMA driver")

Look it is hard to back port to old kernel. Can move it to before cleanup?

> Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
> ---
> drivers/dma/imx-sdma.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index e30dd46cf6522ee2aa4d3aca9868a01afbd29615..6c6d38b202dd2deffc36b1bd27bc7c60de3d7403 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -2232,6 +2232,13 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args *dma_spec,
> ofdma->of_node);
> }
>
> +static void sdma_dma_of_dma_controller_unregister_action(void *data)
> +{
> + struct sdma_engine *sdma = data;
> +
> + of_dma_controller_free(sdma->dev->of_node);
> +}
> +
> static void sdma_dma_device_unregister_action(void *data)
> {
> struct sdma_engine *sdma = data;
> @@ -2370,6 +2377,8 @@ static int sdma_probe(struct platform_device *pdev)
> if (ret)
> return dev_err_probe(dev, ret, "failed to register controller\n");
>
> + devm_add_action_or_reset(dev, sdma_dma_of_dma_controller_unregister_action, sdma);
> +
> spba_bus = of_find_compatible_node(NULL, NULL, "fsl,spba-bus");
> ret = of_address_to_resource(spba_bus, 0, &spba_res);
> if (!ret) {
>
> --
> 2.47.2
>