linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] remoteproc: k3-dsp: Use devm_rproc_alloc() helper
@ 2024-01-23 18:49 Andrew Davis
  2024-01-23 18:49 ` [PATCH 2/8] remoteproc: k3-dsp: Add devm action to release reserved memory Andrew Davis
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Andrew Davis @ 2024-01-23 18:49 UTC (permalink / raw)
  To: Jai Luthra, 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/ti_k3_dsp_remoteproc.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
index ab882e3b7130b..93fbc89307d6a 100644
--- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
@@ -690,8 +690,8 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "failed to parse firmware-name property\n");
 
-	rproc = rproc_alloc(dev, dev_name(dev), &k3_dsp_rproc_ops, fw_name,
-			    sizeof(*kproc));
+	rproc = devm_rproc_alloc(dev, dev_name(dev), &k3_dsp_rproc_ops,
+				 fw_name, sizeof(*kproc));
 	if (!rproc)
 		return -ENOMEM;
 
@@ -707,12 +707,9 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
 	kproc->data = data;
 
 	kproc->ti_sci = ti_sci_get_by_phandle(np, "ti,sci");
-	if (IS_ERR(kproc->ti_sci)) {
-		ret = dev_err_probe(dev, PTR_ERR(kproc->ti_sci),
-				    "failed to get ti-sci handle\n");
-		kproc->ti_sci = NULL;
-		goto free_rproc;
-	}
+	if (IS_ERR(kproc->ti_sci))
+		return dev_err_probe(dev, PTR_ERR(kproc->ti_sci),
+				     "failed to get ti-sci handle\n");
 
 	ret = of_property_read_u32(np, "ti,sci-dev-id", &kproc->ti_sci_id);
 	if (ret) {
@@ -810,8 +807,6 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
 	ret1 = ti_sci_put_handle(kproc->ti_sci);
 	if (ret1)
 		dev_err(dev, "failed to put ti_sci handle (%pe)\n", ERR_PTR(ret1));
-free_rproc:
-	rproc_free(rproc);
 	return ret;
 }
 
@@ -844,7 +839,6 @@ static void k3_dsp_rproc_remove(struct platform_device *pdev)
 		dev_err(dev, "failed to put ti_sci handle (%pe)\n", ERR_PTR(ret));
 
 	k3_dsp_reserved_mem_exit(kproc);
-	rproc_free(kproc->rproc);
 }
 
 static const struct k3_dsp_mem_data c66_mems[] = {
-- 
2.39.2


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

end of thread, other threads:[~2024-02-02 18:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 18:49 [PATCH 1/8] remoteproc: k3-dsp: Use devm_rproc_alloc() helper Andrew Davis
2024-01-23 18:49 ` [PATCH 2/8] remoteproc: k3-dsp: Add devm action to release reserved memory Andrew Davis
2024-01-23 18:49 ` [PATCH 3/8] remoteproc: k3-dsp: Use devm_kcalloc() helper Andrew Davis
2024-01-23 18:49 ` [PATCH 4/8] remoteproc: k3-dsp: Use devm_ti_sci_get_by_phandle() helper Andrew Davis
2024-02-02 18:21   ` Mathieu Poirier
2024-01-23 18:49 ` [PATCH 5/8] remoteproc: k3-dsp: Use devm_kzalloc() helper Andrew Davis
2024-01-23 18:49 ` [PATCH 6/8] remoteproc: k3-dsp: Add devm action to release tsp Andrew Davis
2024-01-23 18:49 ` [PATCH 7/8] remoteproc: k3-dsp: Use devm_ioremap_wc() helper Andrew Davis
2024-01-23 18:49 ` [PATCH 8/8] remoteproc: k3-dsp: 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;
as well as URLs for NNTP newsgroup(s).