[PATCH 2/3] clk: qcom: rcg2: Propagate force-enable status errors

From: Konrad Dybcio

Date: Thu Sep 17 2026 - 05:16:08 EST


From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>

clk_rcg2_is_enabled() returns either a hardware status or a negative
regmap error. The force-enable polling loop treats every nonzero return as
an enabled clock, so a failed status read is incorrectly reported as
success and clock reconfiguration can continue with unknown hardware
state.

Check for negative returns before testing the enabled status and propagate
the read error to the caller.

Fixes: 7ef6f11887bd ("clk: qcom: Configure the RCGs to a safe source as needed")
Assisted-by: LLM
Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
---
drivers/clk/qcom/clk-rcg2.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
index adb03c3aa0dc..54d122e2e0d6 100644
--- a/drivers/clk/qcom/clk-rcg2.c
+++ b/drivers/clk/qcom/clk-rcg2.c
@@ -1332,7 +1332,10 @@ static int clk_rcg2_set_force_enable(struct clk_hw *hw)

/* wait for RCG to turn ON */
for (count = 500; count > 0; count--) {
- if (clk_rcg2_is_enabled(hw))
+ ret = clk_rcg2_is_enabled(hw);
+ if (ret < 0)
+ return ret;
+ if (ret)
return 0;

udelay(1);

--
2.55.0