Skip to content

Commit 006c66d

Browse files
BuiDucPhucbroonie
authored andcommitted
regmap: reject volatile update_bits() in cache-only mode
Prevent _regmap_update_bits() from accessing hardware when the register map is in cache-only mode. Unlike regmap_raw_read() and _regmap_read(), the volatile _regmap_update_bits() fast path bypasses the cache_only check. This can result in unexpected hardware accesses while the device is suspended. Return -EBUSY to ensure behavior is consistent with other cache-only access paths. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260528053204.46783-1-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent e7ae89a commit 006c66d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/base/regmap/regmap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3257,6 +3257,9 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
32573257
*change = false;
32583258

32593259
if (regmap_volatile(map, reg) && map->reg_update_bits) {
3260+
if (map->cache_only)
3261+
return -EBUSY;
3262+
32603263
reg = regmap_reg_addr(map, reg);
32613264
ret = map->reg_update_bits(map->bus_context, reg, mask, val);
32623265
if (ret == 0 && change)

0 commit comments

Comments
 (0)