Commit 8f12de79 authored by Andrew Davis's avatar Andrew Davis Committed by Mathieu Poirier

remoteproc: imx_dsp_rproc: Use devm_rproc_alloc() helper

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: default avatarAndrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240123184632.725054-1-afd@ti.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
parent 92a0915a
...@@ -1104,8 +1104,8 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev) ...@@ -1104,8 +1104,8 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
return ret; return ret;
} }
rproc = rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops, fw_name, rproc = devm_rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops,
sizeof(*priv)); fw_name, sizeof(*priv));
if (!rproc) if (!rproc)
return -ENOMEM; return -ENOMEM;
...@@ -1125,14 +1125,14 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev) ...@@ -1125,14 +1125,14 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
ret = imx_dsp_rproc_detect_mode(priv); ret = imx_dsp_rproc_detect_mode(priv);
if (ret) { if (ret) {
dev_err(dev, "failed on imx_dsp_rproc_detect_mode\n"); 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 */ /* There are multiple power domains required by DSP on some platform */
ret = imx_dsp_attach_pm_domains(priv); ret = imx_dsp_attach_pm_domains(priv);
if (ret) { if (ret) {
dev_err(dev, "failed on imx_dsp_attach_pm_domains\n"); dev_err(dev, "failed on imx_dsp_attach_pm_domains\n");
goto err_put_rproc; return ret;
} }
/* Get clocks */ /* Get clocks */
ret = imx_dsp_rproc_clk_get(priv); ret = imx_dsp_rproc_clk_get(priv);
...@@ -1155,8 +1155,6 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev) ...@@ -1155,8 +1155,6 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
err_detach_domains: err_detach_domains:
imx_dsp_detach_pm_domains(priv); imx_dsp_detach_pm_domains(priv);
err_put_rproc:
rproc_free(rproc);
return ret; return ret;
} }
...@@ -1169,7 +1167,6 @@ static void imx_dsp_rproc_remove(struct platform_device *pdev) ...@@ -1169,7 +1167,6 @@ static void imx_dsp_rproc_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
rproc_del(rproc); rproc_del(rproc);
imx_dsp_detach_pm_domains(priv); imx_dsp_detach_pm_domains(priv);
rproc_free(rproc);
} }
/* pm runtime functions */ /* pm runtime functions */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment