mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 04:34:08 +08:00
remoteproc: qcom_q6v5_mss: 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: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123184632.725054-4-afd@ti.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
This commit is contained in:
parent
5789e877b9
commit
2f09fa9f7a
@ -1990,8 +1990,8 @@ static int q6v5_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
rproc = rproc_alloc(&pdev->dev, pdev->name, &q6v5_ops,
|
||||
mba_image, sizeof(*qproc));
|
||||
rproc = devm_rproc_alloc(&pdev->dev, pdev->name, &q6v5_ops,
|
||||
mba_image, sizeof(*qproc));
|
||||
if (!rproc) {
|
||||
dev_err(&pdev->dev, "failed to allocate rproc\n");
|
||||
return -ENOMEM;
|
||||
@ -2008,7 +2008,7 @@ static int q6v5_probe(struct platform_device *pdev)
|
||||
1, &qproc->hexagon_mdt_image);
|
||||
if (ret < 0 && ret != -EINVAL) {
|
||||
dev_err(&pdev->dev, "unable to read mpss firmware-name\n");
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, qproc);
|
||||
@ -2019,17 +2019,17 @@ static int q6v5_probe(struct platform_device *pdev)
|
||||
qproc->has_spare_reg = desc->has_spare_reg;
|
||||
ret = q6v5_init_mem(qproc, pdev);
|
||||
if (ret)
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
|
||||
ret = q6v5_alloc_memory_region(qproc);
|
||||
if (ret)
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
|
||||
ret = q6v5_init_clocks(&pdev->dev, qproc->proxy_clks,
|
||||
desc->proxy_clk_names);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to get proxy clocks.\n");
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
}
|
||||
qproc->proxy_clk_count = ret;
|
||||
|
||||
@ -2037,7 +2037,7 @@ static int q6v5_probe(struct platform_device *pdev)
|
||||
desc->reset_clk_names);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to get reset clocks.\n");
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
}
|
||||
qproc->reset_clk_count = ret;
|
||||
|
||||
@ -2045,7 +2045,7 @@ static int q6v5_probe(struct platform_device *pdev)
|
||||
desc->active_clk_names);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to get active clocks.\n");
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
}
|
||||
qproc->active_clk_count = ret;
|
||||
|
||||
@ -2053,7 +2053,7 @@ static int q6v5_probe(struct platform_device *pdev)
|
||||
desc->proxy_supply);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to get proxy regulators.\n");
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
}
|
||||
qproc->proxy_reg_count = ret;
|
||||
|
||||
@ -2061,7 +2061,7 @@ static int q6v5_probe(struct platform_device *pdev)
|
||||
desc->active_supply);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to get active regulators.\n");
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
}
|
||||
qproc->active_reg_count = ret;
|
||||
|
||||
@ -2074,12 +2074,12 @@ static int q6v5_probe(struct platform_device *pdev)
|
||||
desc->fallback_proxy_supply);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to get fallback proxy regulators.\n");
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
}
|
||||
qproc->fallback_proxy_reg_count = ret;
|
||||
} else if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to init power domains\n");
|
||||
goto free_rproc;
|
||||
return ret;
|
||||
} else {
|
||||
qproc->proxy_pd_count = ret;
|
||||
}
|
||||
@ -2127,8 +2127,6 @@ remove_subdevs:
|
||||
qcom_remove_glink_subdev(rproc, &qproc->glink_subdev);
|
||||
detach_proxy_pds:
|
||||
q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
|
||||
free_rproc:
|
||||
rproc_free(rproc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -2149,8 +2147,6 @@ static void q6v5_remove(struct platform_device *pdev)
|
||||
qcom_remove_glink_subdev(rproc, &qproc->glink_subdev);
|
||||
|
||||
q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
|
||||
|
||||
rproc_free(rproc);
|
||||
}
|
||||
|
||||
static const struct rproc_hexagon_res sc7180_mss = {
|
||||
|
Loading…
Reference in New Issue
Block a user