[PATCH 05/10] remoteproc: qcom_q6v5_adsp: Simplify with dev_err_probe()

From: Krzysztof Kozlowski
Date: Fri Oct 11 2024 - 09:10:47 EST


Use dev_err_probe() to make error and defer code handling simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
---
drivers/remoteproc/qcom_q6v5_adsp.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 572dcb0f055b764f36d0da7c851dcc707bb5ff6e..79dfec517d38980e05ef0196138e6f312c84511d 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -534,15 +534,11 @@ static const struct rproc_ops adsp_ops = {
static int adsp_init_clock(struct qcom_adsp *adsp, const char **clk_ids)
{
int num_clks = 0;
- int i, ret;
+ int i;

adsp->xo = devm_clk_get(adsp->dev, "xo");
- if (IS_ERR(adsp->xo)) {
- ret = PTR_ERR(adsp->xo);
- if (ret != -EPROBE_DEFER)
- dev_err(adsp->dev, "failed to get xo clock");
- return ret;
- }
+ if (IS_ERR(adsp->xo))
+ return dev_err_probe(adsp->dev, PTR_ERR(adsp->xo), "failed to get xo clock");

for (i = 0; clk_ids[i]; i++)
num_clks++;
@@ -708,10 +704,9 @@ static int adsp_probe(struct platform_device *pdev)
return ret;

ret = qcom_rproc_pds_attach(adsp, desc->pd_names, desc->num_pds);
- if (ret < 0) {
- dev_err(&pdev->dev, "Failed to attach proxy power domains\n");
- return ret;
- }
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret,
+ "Failed to attach proxy power domains\n");

ret = adsp_init_reset(adsp);
if (ret)

--
2.43.0