Skip to contentSkip to conversation

regmap: cache: Make sure to sync the last register in a block

PATCH Applied Lars-Peter Clausen 2 participants 2 messages Aug 5, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: cache: Make sure to sync the last register in a block

regcache_sync_block_raw_flush() expects the address of the register after last register that needs to be synced as its parameter. But the last call to regcache_sync_block_raw_flush() in regcache_sync_block_raw() passes the address of the last register in the block. This effectively always skips over the last register in a block, even if it needs to be synced. In order to fix it increase the address by one register.

The issue was introduced in commit 75a5f89 ("regmap: cache: Write consecutive registers in a single block write").

---
 drivers/base/regmap/regcache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/regmap/regcache.c +2 -1
index e691026..3455f83 100644
@@ -719,7 +719,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block,
 		}
 	}
 
-	return regcache_sync_block_raw_flush(map, &data, base, regtmp);
+	return regcache_sync_block_raw_flush(map, &data, base, regtmp +
+			map->reg_stride);
 }
 
 int regcache_sync_block(struct regmap *map, void *block,
Signature · 1 line
1.8.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Lars-Peter Clausen

regcache_sync_block_raw_flush() expects the address of the register after last register that needs to be synced as its parameter. But the last call to regcache_sync_block_raw_flush() in regcache_sync_block_raw() passes the address of the last register in the block. This effectively always skips over the last register in a block, even if it needs to be synced. In order to fix it increase the address by one register.

Applied, thanks.