public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] remoteproc: omap: Use devm_rproc_alloc() helper
@ 2024-06-10 15:17 Andrew Davis
  2024-06-10 15:17 ` [PATCH 2/6] remoteproc: omap: Use devm action to release reserved memory Andrew Davis
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Andrew Davis @ 2024-06-10 15:17 UTC (permalink / raw)
  To: Hari Nagalla, Bjorn Andersson, Mathieu Poirier
  Cc: linux-remoteproc, linux-kernel, Andrew Davis

Use the device lifecycle managed allocation function. This helps prevent
mistakes like freeing out of order in cleanup functions and forgetting to
free on error paths.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/remoteproc/omap_remoteproc.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 8f50ab80e56f4..e91e016583802 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -1305,8 +1305,8 @@ static int omap_rproc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	rproc = rproc_alloc(&pdev->dev, dev_name(&pdev->dev), &omap_rproc_ops,
-			    firmware, sizeof(*oproc));
+	rproc = devm_rproc_alloc(&pdev->dev, dev_name(&pdev->dev), &omap_rproc_ops,
+				 firmware, sizeof(*oproc));
 	if (!rproc)
 		return -ENOMEM;
 
@@ -1318,15 +1318,15 @@ static int omap_rproc_probe(struct platform_device *pdev)
 
 	ret = omap_rproc_of_get_internal_memories(pdev, rproc);
 	if (ret)
-		goto free_rproc;
+		return ret;
 
 	ret = omap_rproc_get_boot_data(pdev, rproc);
 	if (ret)
-		goto free_rproc;
+		return ret;
 
 	ret = omap_rproc_of_get_timers(pdev, rproc);
 	if (ret)
-		goto free_rproc;
+		return ret;
 
 	init_completion(&oproc->pm_comp);
 	oproc->autosuspend_delay = DEFAULT_AUTOSUSPEND_DELAY;
@@ -1337,10 +1337,8 @@ static int omap_rproc_probe(struct platform_device *pdev)
 	pm_runtime_set_autosuspend_delay(&pdev->dev, oproc->autosuspend_delay);
 
 	oproc->fck = devm_clk_get(&pdev->dev, 0);
-	if (IS_ERR(oproc->fck)) {
-		ret = PTR_ERR(oproc->fck);
-		goto free_rproc;
-	}
+	if (IS_ERR(oproc->fck))
+		return PTR_ERR(oproc->fck);
 
 	ret = of_reserved_mem_device_init(&pdev->dev);
 	if (ret) {
@@ -1359,8 +1357,7 @@ static int omap_rproc_probe(struct platform_device *pdev)
 
 release_mem:
 	of_reserved_mem_device_release(&pdev->dev);
-free_rproc:
-	rproc_free(rproc);
+
 	return ret;
 }
 
@@ -1369,7 +1366,6 @@ static void omap_rproc_remove(struct platform_device *pdev)
 	struct rproc *rproc = platform_get_drvdata(pdev);
 
 	rproc_del(rproc);
-	rproc_free(rproc);
 	of_reserved_mem_device_release(&pdev->dev);
 }
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-06-11 17:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10 15:17 [PATCH 1/6] remoteproc: omap: Use devm_rproc_alloc() helper Andrew Davis
2024-06-10 15:17 ` [PATCH 2/6] remoteproc: omap: Use devm action to release reserved memory Andrew Davis
2024-06-10 15:17 ` [PATCH 3/6] remoteproc: omap: Use devm_rproc_add() helper Andrew Davis
2024-06-10 15:17 ` [PATCH 4/6] remoteproc: da8xx: Use devm_rproc_alloc() helper Andrew Davis
2024-06-10 15:17 ` [PATCH 5/6] remoteproc: da8xx: Use devm action to release reserved memory Andrew Davis
2024-06-11 17:58   ` Mathieu Poirier
2024-06-10 15:17 ` [PATCH 6/6] remoteproc: da8xx: Use devm_rproc_add() helper Andrew Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox