[29/42] ASoC: SOF: imx: Use devm_of_reserved_mem_device_init_by_name()

Message ID 20260703193855.110619-30-mukesh.ojha@oss.qualcomm.com (mailing list archive)
State New
Headers
Series of: reserved_mem: Introduce devres helpers and convert drivers |

Commit Message

Mukesh Ojha July 3, 2026, 7:38 p.m. UTC
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 <mukesh.ojha@oss.qualcomm.com>
---
 sound/soc/sof/imx/imx-common.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
  

Comments

Mark Brown July 6, 2026, 12:19 p.m. UTC | #1
On Sat, Jul 04, 2026 at 01:08:42AM +0530, Mukesh Ojha wrote:
> 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.

Acked-by: Mark Brown <Broonie@kernel.org>
  

Patch

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);