summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-10-03 21:57:37 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2023-10-03 21:57:37 +0300
commitcdcb5d194f192ed07f4e4bb85b866cdc8f420ee6 (patch)
tree15bafb9f37dccd10a9ac6078ae6dc671628aaba5 /drivers
parent5e62ed3b1c8a397185af53d6b94f04b9ff21ec7d (diff)
parent7a795ac8d49e2433e1b97caf5e99129daf8e1b08 (diff)
downloadlinux-cdcb5d194f192ed07f4e4bb85b866cdc8f420ee6.tar.xz
Merge tag 'regmap-fix-v6.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap fix from Mark Brown: "A fix for a long standing issue where when we create a new node in an rbtree register cache we were failing to convert the register address of the new register into a bitmask correctly and marking the wrong register as being present in the newly created node. This would only have affected devices with a register stride other than 1 but would corrupt data on those devices" * tag 'regmap-fix-v6.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: rbtree: Fix wrong register marked as in-cache when creating new node
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/regmap/regcache-rbtree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index db716ffd083e..3db88bbcae0f 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -453,7 +453,8 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
if (!rbnode)
return -ENOMEM;
regcache_rbtree_set_register(map, rbnode,
- reg - rbnode->base_reg, value);
+ (reg - rbnode->base_reg) / map->reg_stride,
+ value);
regcache_rbtree_insert(map, &rbtree_ctx->root, rbnode);
rbtree_ctx->cached_rbnode = rbnode;
}