linux/drivers/base/regmap
Russ Weight c8e796895e
regmap: spi-avmm: Fix regmap_bus max_raw_write
The max_raw_write member of the regmap_spi_avmm_bus structure is defined
as:
	.max_raw_write = SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT

SPI_AVMM_VAL_SIZE == 4 and MAX_WRITE_CNT == 1 so this results in a
maximum write transfer size of 4 bytes which provides only enough space to
transfer the address of the target register. It provides no space for the
value to be transferred. This bug became an issue (divide-by-zero in
_regmap_raw_write()) after the following was accepted into mainline:

commit 3981514180 ("regmap: Account for register length when chunking")

Change max_raw_write to include space (4 additional bytes) for both the
register address and value:

	.max_raw_write = SPI_AVMM_REG_SIZE + SPI_AVMM_VAL_SIZE * MAX_WRITE_CNT

Fixes: 7f9fb67358 ("regmap: add Intel SPI Slave to AVMM Bus Bridge support")
Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Signed-off-by: Russ Weight <russell.h.weight@intel.com>
Link: https://lore.kernel.org/r/20230620202824.380313-1-russell.h.weight@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-20 21:31:08 +01:00
..
internal.h regmap: allow upshifting register addresses before performing operations 2023-04-07 17:28:19 +01:00
Kconfig regmap: REGMAP_KUNIT should not select REGMAP 2023-05-08 09:07:51 +09:00
Makefile regmap: Add maple tree based register cache 2023-04-03 12:53:44 +01:00
regcache-flat.c
regcache-maple.c regmap: maple: Drop the RCU read lock while syncing registers 2023-05-24 11:21:52 +01:00
regcache-rbtree.c regmap: Fix possible double-free in regcache_rbtree_exit() 2021-10-12 11:48:43 +01:00
regcache.c regmap: regcache: Don't sync read-only registers 2023-06-13 13:15:00 +01:00
regmap-ac97.c
regmap-debugfs.c mm, treewide: redefine MAX_ORDER sanely 2023-04-05 19:42:46 -07:00
regmap-fsi.c regmap: Add FSI bus support 2022-11-25 19:17:02 +00:00
regmap-i2c.c regmap-i2c: Set regmap max raw r/w from quirks 2021-05-14 13:25:03 +01:00
regmap-i3c.c regmap: Constify static regmap_bus structs 2022-04-04 08:41:50 +01:00
regmap-irq.c Migrate the PCIe-IDIO-24 and WS16C48 GPIO drivers 2023-04-05 21:56:44 +01:00
regmap-kunit.c regmap: Add maple tree based register cache 2023-04-03 12:53:44 +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: replace return 0 with break in switch statement 2022-09-22 12:33:18 +01:00
regmap-ram.c regmap: Add RAM backed register map 2023-03-30 12:25:42 +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: spi-avmm: Fix regmap_bus max_raw_write 2023-06-20 21:31:08 +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-w1.c regmap: Constify static regmap_bus structs 2022-04-04 08:41:50 +01:00
regmap.c regmap: Account for register length when chunking 2023-05-18 10:53:42 +09:00
trace.h regmap: trace: Remove unneeded blank lines 2022-09-05 13:09:45 +01:00