Re: [PATCH] clk: versaclock5: restore cache_only on regcache_sync() failure in resume

Brian Masney <[email protected]>
Newsgroups org.kernel.vger.linux-clk,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi bui,

On Fri, Jul 24, 2026 at 02:46:03PM +0700, [email protected] wrote:
> From: bui duc phuc <[email protected]>
> 
> If regcache_sync() fails in vc5_resume(), the function only logs the
> error, leaving regmap with cache_only disabled even though the register
> cache has not been synchronized with the hardware.
> Re-enable cache_only on failure to restore the state established by
> vc5_suspend().
> 
> Signed-off-by: bui duc phuc <[email protected]>
> ---
>  drivers/clk/clk-versaclock5.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
> index 913fcc5675f1..d87899118905 100644
> --- a/drivers/clk/clk-versaclock5.c
> +++ b/drivers/clk/clk-versaclock5.c
> @@ -1240,8 +1240,10 @@ static int __maybe_unused vc5_resume(struct device *dev)
>  
>  	regcache_cache_only(vc5->regmap, false);
>  	ret = regcache_sync(vc5->regmap);
> -	if (ret)
> +	if (ret) {
> +		regcache_cache_only(vc5->regmap, true);
>  		dev_err(dev, "Failed to restore register map: %d\n", ret);
> +	}
>  	return ret;
>  }

I don't see precedent for this pattern anywhere else in the tree. Is
this an observed problem or something that could theoretically happen?

If this fails in the code today, the pm core will propagate the error,
and the device won't be marked as resumed.

Brian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.