Use the devres-managed devm_of_reserved_mem_device_init_by_name()
instead of the manual of_reserved_mem_device_init_by_name()/
of_reserved_mem_device_release() pair, letting the device resource
manager handle cleanup automatically.

Signed-off-by: Mukesh Ojha <[email protected]>
---
 sound/soc/sof/imx/imx-common.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sof/imx/imx-common.c b/sound/soc/sof/imx/imx-common.c
index 7a03c8cc5dd4..29314022c11f 100644
--- a/sound/soc/sof/imx/imx-common.c
+++ b/sound/soc/sof/imx/imx-common.c
@@ -330,9 +330,6 @@ static void imx_unregister_action(void *data)
        sdev = data;
        common = sdev->pdata->hw_pdata;
 
-       if (get_chip_info(sdev)->has_dma_reserved)
-               of_reserved_mem_device_release(sdev->dev);
-
        platform_device_unregister(common->ipc_dev);
 }
 
@@ -362,9 +359,9 @@ static int imx_probe(struct snd_sof_dev *sdev)
                                     "failed to create IPC device\n");
 
        if (get_chip_info(sdev)->has_dma_reserved) {
-               ret = of_reserved_mem_device_init_by_name(sdev->dev,
-                                                         pdev->dev.of_node,
-                                                         "dma");
+               ret = devm_of_reserved_mem_device_init_by_name(sdev->dev,
+                                                              
pdev->dev.of_node,
+                                                              "dma");
                if (ret) {
                        platform_device_unregister(common->ipc_dev);
 
-- 
2.53.0


Reply via email to