linux-stable/drivers/base/regmap
Richard Fitzgerald 7a795ac8d4
regmap: rbtree: Fix wrong register marked as in-cache when creating new node
When regcache_rbtree_write() creates a new rbtree_node it was passing the
wrong bit number to regcache_rbtree_set_register(). The bit number is the
offset __in number of registers__, but in the case of creating a new block
regcache_rbtree_write() was not dividing by the address stride to get the
number of registers.

Fix this by dividing by map->reg_stride.
Compare with regcache_rbtree_read() where the bit is checked.

This bug meant that the wrong register was marked as present. The register
that was written to the cache could not be read from the cache because it
was not marked as cached. But a nearby register could be marked as having
a cached value even if it was never written to the cache.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 3f4ff561bc ("regmap: rbtree: Make cache_present bitmap per node")
Link: https://lore.kernel.org/r/20230922153711.28103-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-22 16:54:00 +01:00
..
internal.h regmap: Add debugfs file for forcing field writes 2023-06-13 13:15:04 +01:00
Kconfig regmap: Provide user selectable option to enable regmap 2023-07-13 16:20:28 +01:00
Makefile regmap: Provide a ram backed regmap with raw support 2023-06-12 14:47:54 +01:00
regcache-flat.c regmap: add proper SPDX identifiers on files that did not have them. 2019-04-25 20:22:15 +01:00
regcache-maple.c regmap: maple: Use alloc_flags for memory allocations 2023-07-20 20:37:39 +01:00
regcache-rbtree.c regmap: rbtree: Fix wrong register marked as in-cache when creating new node 2023-09-22 16:54:00 +01:00
regcache.c Linux 6.5-rc3 2023-07-23 23:34:06 +01:00
regmap-ac97.c regmap: add proper SPDX identifiers on files that did not have them. 2019-04-25 20:22:15 +01:00
regmap-debugfs.c regmap: Add debugfs file for forcing field writes 2023-06-13 13:15:04 +01:00
regmap-fsi.c regmap: Add FSI bus support 2022-11-25 19:17:02 +00:00
regmap-i2c.c regmap: Account for register length in SMBus I/O limits 2023-07-17 06:15:15 +01:00
regmap-i3c.c regmap: Constify static regmap_bus structs 2022-04-04 08:41:50 +01:00
regmap-irq.c regmap-irq: Fix out-of-bounds access when allocating config buffers 2023-07-12 12:05:10 +01:00
regmap-kunit.c Linux 6.5-rc3 2023-07-23 23:34:06 +01:00
regmap-mdio.c regmap: Rework regmap_mdio_c45_{read|write} for new C45 API. 2023-01-16 13:16:09 +00:00
regmap-mmio.c regmap: mmio: Remove unused 64-bit support code 2023-07-09 22:48:46 +01:00
regmap-ram.c regmap: Add RAM backed register map 2023-03-30 12:25:42 +01:00
regmap-raw-ram.c regmap: Provide a ram backed regmap with raw support 2023-06-12 14:47:54 +01:00
regmap-sccb.c regmap: Constify static regmap_bus structs 2022-04-04 08:41:50 +01:00
regmap-sdw-mbq.c regmap: Constify static regmap_bus structs 2022-04-04 08:41:50 +01:00
regmap-sdw.c regmap: sdw: check for invalid multi-register writes config 2023-05-24 11:21:51 +01:00
regmap-slimbus.c regmap: Constify static regmap_bus structs 2022-04-04 08:41:50 +01:00
regmap-spi-avmm.c regmap: Drop initial version of maximum transfer length fixes 2023-07-17 06:15:14 +01:00
regmap-spi.c regmap: spi: Reserve space for register address/padding 2022-08-18 15:02:05 +01:00
regmap-spmi.c regmap: add proper SPDX identifiers on files that did not have them. 2019-04-25 20:22:15 +01:00
regmap-w1.c regmap: Constify static regmap_bus structs 2022-04-04 08:41:50 +01:00
regmap.c Linux 6.5-rc3 2023-07-23 23:34:06 +01:00
trace.h regmap: trace: Remove unneeded blank lines 2022-09-05 13:09:45 +01:00