Skip to content

Commit 9108f7f

Browse files
Francesco Lavrabroonie
authored andcommitted
regcache: Do not overwrite error code when finalizing cache after error
During regcache initialization, if an error occurs in the cache_ops->populate callback, and if cache operations include an exit callback, the error code from populate() is overwritten with the return value from exit(). This hides the error condition from the caller of regcache_init(), and can cause NULL pointer dereferences when the regcache is later accessed. Fixes: 94a3a95 ("regcache: Add ->populate() callback to separate from ->init()") Signed-off-by: Francesco Lavra <flavra@baylibre.com> Link: https://patch.msgid.link/20260616114429.1852456-1-flavra@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 34808ac commit 9108f7f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/base/regmap/regcache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
245245
if (map->cache_ops->exit) {
246246
dev_dbg(map->dev, "Destroying %s cache\n", map->cache_ops->name);
247247
map->lock(map->lock_arg);
248-
ret = map->cache_ops->exit(map);
248+
map->cache_ops->exit(map);
249249
map->unlock(map->lock_arg);
250250
}
251251
err_free_reg_defaults:

0 commit comments

Comments
 (0)