Skip to content

regmap: Improve error handling in regcache_sync()

[email protected] driver-core lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2regcache: Preserve cache synchronization errors in regcache_sync()drivers/base/regmap/regcache.c+12 -110 replies
2/2regcache: Mark cache dirty if selector register rewrite failsdrivers/base/regmap/regcache.c+1 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

From: bui duc phuc <[email protected]>

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/[email protected]/

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(-)
Signature · 1 line
2.43.0