Skip to content

Commit fea8806

Browse files
HiassofTbroonie
authored andcommitted
regmap: fix bogus error on regcache_sync success
Since commit 0ec7731 ("regmap: Ensure range selector registers are updated after cache sync") opening pcm512x based soundcards fail with EINVAL and dmesg shows sync cache and pm_runtime_get errors: [ 228.794676] pcm512x 1-004c: Failed to sync cache: -22 [ 228.794740] pcm512x 1-004c: ASoC: error at snd_soc_pcm_component_pm_runtime_get on pcm512x.1-004c: -22 This is caused by the cache check result leaking out into the regcache_sync return value. Fix this by making the check local-only, as the comment above the regcache_read call states a non-zero return value means there's nothing to do so the return value should not be altered. Fixes: 0ec7731 ("regmap: Ensure range selector registers are updated after cache sync") Cc: [email protected] Signed-off-by: Matthias Reichl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b85ea95 commit fea8806

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/base/regmap/regcache.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ int regcache_sync(struct regmap *map)
410410
rb_entry(node, struct regmap_range_node, node);
411411

412412
/* If there's nothing in the cache there's nothing to sync */
413-
ret = regcache_read(map, this->selector_reg, &i);
414-
if (ret != 0)
413+
if (regcache_read(map, this->selector_reg, &i) != 0)
415414
continue;
416415

417416
ret = _regmap_write(map, this->selector_reg, i);

0 commit comments

Comments
 (0)