Commit 456a75ab authored by Andrew Davis's avatar Andrew Davis Committed by Mathieu Poirier

remoteproc: k3-dsp: Use devm_rproc_add() helper

Use device lifecycle managed devm_rproc_add() helper function. This helps
prevent mistakes like deleting out of order in cleanup functions and
forgetting to delete on all error paths.
Signed-off-by: default avatarAndrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240205182753.36978-6-afd@ti.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
parent 8a5d6899
...@@ -768,7 +768,7 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev) ...@@ -768,7 +768,7 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
} }
} }
ret = rproc_add(rproc); ret = devm_rproc_add(dev, rproc);
if (ret) if (ret)
return dev_err_probe(dev, ret, "failed to add register device with remoteproc core\n"); return dev_err_probe(dev, ret, "failed to add register device with remoteproc core\n");
...@@ -786,14 +786,9 @@ static void k3_dsp_rproc_remove(struct platform_device *pdev) ...@@ -786,14 +786,9 @@ static void k3_dsp_rproc_remove(struct platform_device *pdev)
if (rproc->state == RPROC_ATTACHED) { if (rproc->state == RPROC_ATTACHED) {
ret = rproc_detach(rproc); ret = rproc_detach(rproc);
if (ret) { if (ret)
/* Note this error path leaks resources */
dev_err(dev, "failed to detach proc (%pe)\n", ERR_PTR(ret)); dev_err(dev, "failed to detach proc (%pe)\n", ERR_PTR(ret));
return;
} }
}
rproc_del(kproc->rproc);
} }
static const struct k3_dsp_mem_data c66_mems[] = { static const struct k3_dsp_mem_data c66_mems[] = {
......
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