Hi Reza,

On 9/15/2026 12:01 PM, Reza Kurniawan wrote:
For devices marked with skip_init ("qcom,prng-ee" and "qcom,trng"),
msm_rng_probe() currently returns early before retrieving the clock.
As a result, priv->clk remains uninitialized, causing subsequent calls
to msm_rng_read() to skip enabling the clock which may cause failure
if the device boots with the clock disabled.

Move clk_get_by_index() before the skip_init check so that any clock
specified in device tree is properly recorded. Additionally, treat
-ENOENT as non-fatal so the clock remains optional for devices (such
as some "qcom,trng" nodes) that do not define one.

Signed-off-by: Reza Kurniawan <[email protected]>
Reviewed-by: Balaji Selvanathan <[email protected]>
---
  drivers/rng/msm_rng.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rng/msm_rng.c b/drivers/rng/msm_rng.c
index aab602c5e..68f25ac51 100644
--- a/drivers/rng/msm_rng.c
+++ b/drivers/rng/msm_rng.c
@@ -114,13 +114,13 @@ static int msm_rng_probe(struct udevice *dev)
        if (priv->base == FDT_ADDR_T_NONE)
                return -EINVAL;
- if (priv->skip_init)
-               return 0;
-
        ret = clk_get_by_index(dev, 0, &priv->clk);
-       if (ret)
+       if (ret && ret != -ENOENT)
                return ret;
+ if (priv->skip_init)
+               return 0;
+
        ret = clk_enable(&priv->clk);
        if (ret < 0)
                return ret;

---
base-commit: 0e2a0ceeefa0ae10118b8364da62f1fb86f286c0
change-id: 20260914-qcom-rng-fix-a7dabc760daf

Best regards,
--
Reza Kurniawan <[email protected]>

Reply via email to