Re: [PATCH 2/3] clk: qcom: gdsc: propagate gdsc_enable() failure for ALWAYS_ON domains
From: Dmitry Baryshkov
Date: Mon Jun 08 2026 - 02:48:36 EST
On Tue, Jun 02, 2026 at 04:09:33PM +0200, Herman van Hazendonk wrote:
> GENPD_FLAG_ALWAYS_ON requires the underlying domain to be on at
> genpd_init() time -- the framework will refuse to register the domain
> otherwise. When the cold readback in gdsc_init() finds an ALWAYS_ON
> GDSC powered down, the driver tries to bring it back up:
>
> } else if (sc->flags & ALWAYS_ON) {
> /* If ALWAYS_ON GDSCs are not ON, turn them ON */
> gdsc_enable(&sc->pd);
> on = true;
> }
>
> but discards the return value: if gdsc_enable() fails (regmap write
> error, the long-form sequence's status poll times out, or the
> HW_CTRL hand-off errors) the code still sets on=true and falls
> through to pm_genpd_init(..., !on) -- which then registers the
> domain in the ON state and sets GENPD_FLAG_ALWAYS_ON, even though
> the silicon is actually off. Subsequent consumer probes will see
> genpd report "on" while accessing dead registers and hang or read
> garbage.
>
> Catch the failure and surface it: returning the error from
> gdsc_init() makes the provider probe fail with the underlying errno,
> which propagates to consumers as -EPROBE_DEFER (or fatal if the
> hardware really is broken) rather than silently lying about the
> rail state.
>
> Signed-off-by: Herman van Hazendonk <github.com@xxxxxxxxxx>
> ---
> drivers/clk/qcom/gdsc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Fixes: fb55bea1fe43 ("clk: qcom: gdsc: Add support for ALWAYS_ON gdscs")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
--
With best wishes
Dmitry