diff options
| author | Mark Brown <broonie@kernel.org> | 2026-10-06 18:08:01 +0200 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-06 18:08:01 +0200 |
| commit | 5ff1a5ca9f58681f870501ac58c4293306fdce0e (patch) | |
| tree | a584d9a074e7d595bce06db63daeced48f88e157 /scripts/livepatch | |
| parent | 012c37f09490db4d9b51bbcbf8def4436fc60f06 (diff) | |
| parent | a93de1d65c6b5e4d493640be7f1429faad47a584 (diff) | |
| download | linux-next-5ff1a5ca9f58681f870501ac58c4293306fdce0e.tar.gz linux-next-5ff1a5ca9f58681f870501ac58c4293306fdce0e.zip | |
regmap: cleanups for regcache and regmap init paths
Peng Fan (OSS) <peng.fan@oss.nxp.com> says:
Following up the previous regmap guard lock patchset [1].
[1] https://lore.kernel.org/all/179062150526.139547.3870545428656485907.b4-ty@b4/#r
This is the 2nd batch to do more cleanup.
This series tidies up locking, error handling, and resource management
across the regmap core and regcache.
- Extract regcache_locked_op() and regcache_locked_exit() helpers to
replace open-coded lock/unlock pairs in regcache_init() and
regcache_exit(), avoiding the cleanup.h-vs-goto concern that
prevented the earlier scoped lock guard conversion.
- Extract __regcache_sync() to deduplicate the sync dispatch logic
shared between regcache_sync() and regcache_sync_region().
- Flatten control flow in regcache_init(), regcache_lookup_reg(), and
regcache_sync_block() by using early returns, moving guards into
helpers, and merging redundant sanity checks.
- Switch regmap_register_patch() from krealloc() to krealloc_array()
for overflow-safe element-count arithmetic.
- NULL map->reg_defaults after freeing in regcache_exit() to prevent
a potential double-free if regmap_reinit_cache() later fails during
cache re-initialisation.
Tested with the regmap KUnit suite (drivers/base/regmap/regmap-kunit.c)
with lockdep (PROVE_LOCKING, DEBUG_LOCK_ALLOC, DEBUG_ATOMIC_SLEEP) enabled.
Built clean with sparse (C=1).
Link: https://patch.msgid.link/20261002-regmap-lock-2nd-v2-0-e172b0501c52@nxp.com
Diffstat (limited to 'scripts/livepatch')
0 files changed, 0 insertions, 0 deletions
