aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 79446262812c..27fae58ff4cb 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -144,9 +144,18 @@ int regcache_init(struct regmap *map)
144 if (map->cache_ops->init) { 144 if (map->cache_ops->init) {
145 dev_dbg(map->dev, "Initializing %s cache\n", 145 dev_dbg(map->dev, "Initializing %s cache\n",
146 map->cache_ops->name); 146 map->cache_ops->name);
147 return map->cache_ops->init(map); 147 ret = map->cache_ops->init(map);
148 if (ret)
149 goto err_free;
148 } 150 }
149 return 0; 151 return 0;
152
153err_free:
154 kfree(map->reg_defaults);
155 if (map->cache_free)
156 kfree(map->reg_defaults_raw);
157
158 return ret;
150} 159}
151 160
152void regcache_exit(struct regmap *map) 161void regcache_exit(struct regmap *map)