Skip to content

Commit 8447d0e

Browse files
Mani-Sadhasivamandersson
authored andcommitted
remoteproc: qcom_q6v5_pas: Do not fail if regulators are not found
devm_regulator_get_optional() API will return -ENODEV if the regulator was not found. For the optional supplies CX, PX we should not fail in that case but rather continue. So let's catch that error and continue silently if those regulators are not found. The commit 3f52d11 ("remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators") was supposed to do the same but it missed the fact that devm_regulator_get_optional() API returns -ENODEV when the regulator was not found. Cc: Abel Vesa <[email protected]> Fixes: 3f52d11 ("remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators") Reported-by: Steev Klimaszewski <[email protected]> Reviewed-by: Abel Vesa <[email protected]> Reviewed-by: Johan Hovold <[email protected]> Tested-by: Steev Klimaszewski <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bf24ecc commit 8447d0e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

drivers/remoteproc/qcom_q6v5_pas.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,25 @@ static int adsp_init_clock(struct qcom_adsp *adsp)
362362
static int adsp_init_regulator(struct qcom_adsp *adsp)
363363
{
364364
adsp->cx_supply = devm_regulator_get_optional(adsp->dev, "cx");
365-
if (IS_ERR(adsp->cx_supply))
366-
return PTR_ERR(adsp->cx_supply);
365+
if (IS_ERR(adsp->cx_supply)) {
366+
if (PTR_ERR(adsp->cx_supply) == -ENODEV)
367+
adsp->cx_supply = NULL;
368+
else
369+
return PTR_ERR(adsp->cx_supply);
370+
}
367371

368-
regulator_set_load(adsp->cx_supply, 100000);
372+
if (adsp->cx_supply)
373+
regulator_set_load(adsp->cx_supply, 100000);
369374

370375
adsp->px_supply = devm_regulator_get_optional(adsp->dev, "px");
371-
return PTR_ERR_OR_ZERO(adsp->px_supply);
376+
if (IS_ERR(adsp->px_supply)) {
377+
if (PTR_ERR(adsp->px_supply) == -ENODEV)
378+
adsp->px_supply = NULL;
379+
else
380+
return PTR_ERR(adsp->px_supply);
381+
}
382+
383+
return 0;
372384
}
373385

374386
static int adsp_pds_attach(struct device *dev, struct device **devs,

0 commit comments

Comments
 (0)