diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2026-03-03 12:26:24 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-03-03 16:03:59 +0300 |
| commit | 9891b52ba12e9d5fed5901b6b5f6e0cdcd424390 (patch) | |
| tree | 90a02130704e4d8e450c6b6d22a11a9543fd9d59 | |
| parent | c26137d3a3a8168b49679e30cf3c08177bb2dbe7 (diff) | |
| download | linux-9891b52ba12e9d5fed5901b6b5f6e0cdcd424390.tar.xz | |
regcache: Factor out regcache_hw_exit() helper
Factor out regcache_hw_exit() helper to make error and exit paths
clearer. This helps to avoid missing changes in case the code gets
shuffled in the future.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260303092820.2818138-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | drivers/base/regmap/regcache.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 13c480b6e21d..329cdee1ae1c 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -131,6 +131,13 @@ err_free: return ret; } +static void regcache_hw_exit(struct regmap *map) +{ + kfree(map->reg_defaults); + if (map->cache_free) + kfree(map->reg_defaults_raw); +} + int regcache_init(struct regmap *map, const struct regmap_config *config) { int count = 0; @@ -245,9 +252,7 @@ err_exit: map->unlock(map->lock_arg); } err_free: - kfree(map->reg_defaults); - if (map->cache_free) - kfree(map->reg_defaults_raw); + regcache_hw_exit(map); return ret; } @@ -259,9 +264,7 @@ void regcache_exit(struct regmap *map) BUG_ON(!map->cache_ops); - kfree(map->reg_defaults); - if (map->cache_free) - kfree(map->reg_defaults_raw); + regcache_hw_exit(map); if (map->cache_ops->exit) { dev_dbg(map->dev, "Destroying %s cache\n", |
