remoteproc: qcom_q6v5_pas: Use devm_rproc_alloc() helper
authorAndrew Davis <afd@ti.com>
Tue, 23 Jan 2024 18:46:28 +0000 (12:46 -0600)
committerBjorn Andersson <andersson@kernel.org>
Wed, 6 Mar 2024 04:00:04 +0000 (20:00 -0800)
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>
Link: https://lore.kernel.org/r/20240123184632.725054-5-afd@ti.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/remoteproc/qcom_q6v5_pas.c

index 3235249d703ddb9e3eb8702c472308e35561f3ec..452e96392525d5bbb2da8433aa39f5ac9bca0c09 100644 (file)
@@ -705,7 +705,7 @@ static int adsp_probe(struct platform_device *pdev)
        if (desc->minidump_id)
                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) {
                dev_err(&pdev->dev, "unable to allocate remoteproc\n");
@@ -784,7 +784,6 @@ detach_proxy_pds:
        adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
 free_rproc:
        device_init_wakeup(adsp->dev, false);
-       rproc_free(rproc);
 
        return ret;
 }
@@ -803,7 +802,6 @@ static void adsp_remove(struct platform_device *pdev)
        qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev);
        adsp_pds_detach(adsp, adsp->proxy_pds, adsp->proxy_pd_count);
        device_init_wakeup(adsp->dev, false);
-       rproc_free(adsp->rproc);
 }
 
 static const struct adsp_data adsp_resource_init = {