diff options
author | Nikita Yushchenko <nikita.yoush@cogentembedded.com> | 2016-09-22 12:02:25 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-09-22 11:24:22 +0100 |
commit | f0aa1ce6259eb65f53f969b3250c1d0aac84f30b (patch) | |
tree | 1015781676836a0e849c65a49e50679c1884b24d /drivers/base/regmap | |
parent | 815806e39bf6f7e7b34875d4a9609dbe76661782 (diff) | |
download | op-kernel-dev-f0aa1ce6259eb65f53f969b3250c1d0aac84f30b.zip op-kernel-dev-f0aa1ce6259eb65f53f969b3250c1d0aac84f30b.tar.gz |
regmap: fix deadlock on _regmap_raw_write() error path
Commit 815806e39bf6 ("regmap: drop cache if the bus transfer error")
added a call to regcache_drop_region() to error path in
_regmap_raw_write(). However that path runs with regmap lock taken,
and regcache_drop_region() tries to re-take it, causing a deadlock.
Fix that by calling map->cache_ops->drop() directly.
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r-- | drivers/base/regmap/regmap.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 25d26bb..e964d06 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1475,7 +1475,11 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, kfree(buf); } else if (ret != 0 && !map->cache_bypass && map->format.parse_val) { - regcache_drop_region(map, reg, reg + 1); + /* regcache_drop_region() takes lock that we already have, + * thus call map->cache_ops->drop() directly + */ + if (map->cache_ops && map->cache_ops->drop) + map->cache_ops->drop(map, reg, reg + 1); } trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes); |