From: Andrew Davis <afd@ti.com>
To: Hari Nagalla <hnagalla@ti.com>,
Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Andrew Davis <afd@ti.com>
Subject: [PATCH 4/6] remoteproc: da8xx: Use devm_rproc_alloc() helper
Date: Mon, 10 Jun 2024 10:17:19 -0500 [thread overview]
Message-ID: <20240610151721.189472-4-afd@ti.com> (raw)
In-Reply-To: <20240610151721.189472-1-afd@ti.com>
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/da8xx_remoteproc.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index 9041a0e07fb25..c8b7576937733 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -295,8 +295,8 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
}
}
- rproc = rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name,
- sizeof(*drproc));
+ rproc = devm_rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name,
+ sizeof(*drproc));
if (!rproc) {
ret = -ENOMEM;
goto free_mem;
@@ -313,7 +313,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
ret = da8xx_rproc_get_internal_memories(pdev, drproc);
if (ret)
- goto free_rproc;
+ goto free_mem;
platform_set_drvdata(pdev, rproc);
@@ -323,7 +323,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
rproc);
if (ret) {
dev_err(dev, "devm_request_threaded_irq error: %d\n", ret);
- goto free_rproc;
+ goto free_mem;
}
/*
@@ -333,7 +333,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
*/
ret = reset_control_assert(dsp_reset);
if (ret)
- goto free_rproc;
+ goto free_mem;
drproc->chipsig = chipsig;
drproc->bootreg = bootreg;
@@ -344,13 +344,11 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
ret = rproc_add(rproc);
if (ret) {
dev_err(dev, "rproc_add failed: %d\n", ret);
- goto free_rproc;
+ goto free_mem;
}
return 0;
-free_rproc:
- rproc_free(rproc);
free_mem:
if (dev->of_node)
of_reserved_mem_device_release(dev);
@@ -371,7 +369,6 @@ static void da8xx_rproc_remove(struct platform_device *pdev)
disable_irq(drproc->irq);
rproc_del(rproc);
- rproc_free(rproc);
if (dev->of_node)
of_reserved_mem_device_release(dev);
}
--
2.39.2
next prev parent reply other threads:[~2024-06-10 15:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Andrew Davis [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240610151721.189472-4-afd@ti.com \
--to=afd@ti.com \
--cc=andersson@kernel.org \
--cc=hnagalla@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox