linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] remoteproc: imx_dsp_rproc: Use devm_rproc_alloc() helper
@ 2024-01-23 18:46 Andrew Davis
  2024-01-23 18:46 ` [PATCH 2/9] remoteproc: imx_rproc: " Andrew Davis
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Andrew Davis @ 2024-01-23 18:46 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Konrad Dybcio, Patrice Chotard, Maxime Coquelin, Alexandre Torgue
  Cc: linux-remoteproc, linux-arm-kernel, linux-kernel, linux-arm-msm,
	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/imx_dsp_rproc.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
index a1c62d15f16c6..56a799cb8b363 100644
--- a/drivers/remoteproc/imx_dsp_rproc.c
+++ b/drivers/remoteproc/imx_dsp_rproc.c
@@ -1104,8 +1104,8 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	rproc = rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops, fw_name,
-			    sizeof(*priv));
+	rproc = devm_rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops,
+				 fw_name, sizeof(*priv));
 	if (!rproc)
 		return -ENOMEM;
 
@@ -1125,14 +1125,14 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
 	ret = imx_dsp_rproc_detect_mode(priv);
 	if (ret) {
 		dev_err(dev, "failed on imx_dsp_rproc_detect_mode\n");
-		goto err_put_rproc;
+		return ret;
 	}
 
 	/* There are multiple power domains required by DSP on some platform */
 	ret = imx_dsp_attach_pm_domains(priv);
 	if (ret) {
 		dev_err(dev, "failed on imx_dsp_attach_pm_domains\n");
-		goto err_put_rproc;
+		return ret;
 	}
 	/* Get clocks */
 	ret = imx_dsp_rproc_clk_get(priv);
@@ -1155,8 +1155,6 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
 
 err_detach_domains:
 	imx_dsp_detach_pm_domains(priv);
-err_put_rproc:
-	rproc_free(rproc);
 
 	return ret;
 }
@@ -1169,7 +1167,6 @@ static void imx_dsp_rproc_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	rproc_del(rproc);
 	imx_dsp_detach_pm_domains(priv);
-	rproc_free(rproc);
 }
 
 /* pm runtime functions */
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

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

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 18:46 [PATCH 1/9] remoteproc: imx_dsp_rproc: Use devm_rproc_alloc() helper Andrew Davis
2024-01-23 18:46 ` [PATCH 2/9] remoteproc: imx_rproc: " Andrew Davis
2024-01-24 22:12   ` Iuliana Prodan
2024-01-23 18:46 ` [PATCH 3/9] remoteproc: qcom_q6v5_adsp: " Andrew Davis
2024-01-23 18:46 ` [PATCH 4/9] remoteproc: qcom_q6v5_mss: " Andrew Davis
2024-01-23 18:46 ` [PATCH 5/9] remoteproc: qcom_q6v5_pas: " Andrew Davis
2024-01-23 18:46 ` [PATCH 6/9] remoteproc: qcom_q6v5_wcss: " Andrew Davis
2024-02-02 20:51   ` Unnathi Chalicheemala
2024-02-02 21:14     ` Andrew Davis
2024-02-02 21:37       ` Unnathi Chalicheemala
2024-01-23 18:46 ` [PATCH 7/9] remoteproc: qcom_wcnss: " Andrew Davis
2024-01-23 18:46 ` [PATCH 8/9] remoteproc: st: " Andrew Davis
2024-01-23 18:46 ` [PATCH 9/9] remoteproc: stm32: " Andrew Davis
2024-02-02 18:41   ` Mathieu Poirier
2024-01-24 22:11 ` [PATCH 1/9] remoteproc: imx_dsp_rproc: " Iuliana Prodan

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