acrn-kernel/drivers/base/regmap
Russ Weight 277a7c23b5 regmap: spi-avmm: Fix regmap_bus max_raw_write
[ Upstream commit c8e796895e ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-28 11:12:26 +02:00
..
Kconfig
Makefile
internal.h
regcache-flat.c
regcache-lzo.c
regcache-rbtree.c
regcache.c
regmap-ac97.c
regmap-debugfs.c
regmap-i2c.c
regmap-i3c.c
regmap-irq.c
regmap-mdio.c
regmap-mmio.c
regmap-sccb.c
regmap-sdw-mbq.c
regmap-sdw.c
regmap-slimbus.c
regmap-spi-avmm.c regmap: spi-avmm: Fix regmap_bus max_raw_write 2023-06-28 11:12:26 +02:00
regmap-spi.c
regmap-spmi.c
regmap-w1.c
regmap.c regmap: Account for register length when chunking 2023-06-09 10:34:28 +02:00
trace.h