[PATCH 0/2] regmap: Improve error handling in regcache_sync()

phucduc.bui@gmail.com posted 2 patches 1 week, 5 days ago
drivers/base/regmap/regcache.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
[PATCH 0/2] regmap: Improve error handling in regcache_sync()
Posted by phucduc.bui@gmail.com 1 week, 5 days ago
From: bui duc phuc <phucduc.bui@gmail.com>

Hi all, 

While working on a cleanup series converting mutex and spinlock usage
to guard() helpers, I received review feedback that regcache_sync()
still has a goto-based error path.

https://lore.kernel.org/all/95f5d6ec-ecc5-4090-ac04-27cdcdc21b8a@sirena.org.uk/

Since guard() helpers should not be mixed with goto-based cleanup, 
I looked into whether the error handling could be simplified.

During that review, I noticed two issues in the current implementation
of regcache_sync():

 1. Cache synchronization errors can be overwritten by the result of
    selector register updates.
 2. cache_dirty is not updated if rewriting a selector register fails,
    leaving it inconsistent with the cache and hardware state. 

Together, these changes make the failure semantics of regcache_sync() 
clearer and eliminate the need for callers to invoke
regcache_mark_dirty() after regcache_sync() fails.

Best regards,
Phuc

bui duc phuc (2):
  regcache: Preserve cache synchronization errors in regcache_sync()
  regcache: Mark cache dirty if selector register rewrite fails

 drivers/base/regmap/regcache.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

-- 
2.43.0
Re: [PATCH 0/2] regmap: Improve error handling in regcache_sync()
Posted by Mark Brown 1 week, 5 days ago
On Mon, 13 Jul 2026 12:03:10 +0700, phucduc.bui@gmail.com wrote:
> regmap: Improve error handling in regcache_sync()
> 
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> Hi all,
> 
> While working on a cleanup series converting mutex and spinlock usage
> to guard() helpers, I received review feedback that regcache_sync()
> still has a goto-based error path.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-7.3

Thanks!

[1/2] regcache: Preserve cache synchronization errors in regcache_sync()
      https://git.kernel.org/broonie/regmap/c/85da24aac16a
[2/2] regcache: Mark cache dirty if selector register rewrite fails
      https://git.kernel.org/broonie/regmap/c/a7d168db6bb7

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark