Commit 35049a98 authored by Andrew Davis's avatar Andrew Davis Committed by Bjorn Andersson

remoteproc: qcom_q6v5_pas: 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-5-afd@ti.comSigned-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent 2f09fa9f
...@@ -705,7 +705,7 @@ static int adsp_probe(struct platform_device *pdev) ...@@ -705,7 +705,7 @@ static int adsp_probe(struct platform_device *pdev)
if (desc->minidump_id) if (desc->minidump_id)
ops = &adsp_minidump_ops; ops = &adsp_minidump_ops;
rproc = rproc_alloc(&pdev->dev, pdev->name, ops, fw_name, sizeof(*adsp)); rproc = devm_rproc_alloc(&pdev->dev, pdev->name, ops, fw_name, sizeof(*adsp));
if (!rproc) { if (!rproc) {
dev_err(&pdev->dev, "unable to allocate remoteproc\n"); dev_err(&pdev->dev, "unable to allocate remoteproc\n");
...@@ -784,7 +784,6 @@ static int adsp_probe(struct platform_device *pdev) ...@@ -784,7 +784,6 @@ static int adsp_probe(struct platform_device *pdev)
adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count); adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
free_rproc: free_rproc:
device_init_wakeup(adsp->dev, false); device_init_wakeup(adsp->dev, false);
rproc_free(rproc);
return ret; return ret;
} }
...@@ -803,7 +802,6 @@ static void adsp_remove(struct platform_device *pdev) ...@@ -803,7 +802,6 @@ static void adsp_remove(struct platform_device *pdev)
qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev); qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev);
adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count); adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
device_init_wakeup(adsp->dev, false); device_init_wakeup(adsp->dev, false);
rproc_free(adsp->rproc);
} }
static const struct adsp_data adsp_resource_init = { static const struct adsp_data adsp_resource_init = {
......
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