Commit 6e6ace00a045251bd172b9b9c2379857bbff3dc7
1 parent
f094fea68f
Exists in
master
and in
6 other branches
regmap: Return a sensible error code if we fail to read the cache
If a register isn't cached then let callers know that so they can fall back or error handle appropriately. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Showing 4 changed files with 7 additions and 9 deletions Side-by-side Diff
drivers/base/regmap/regcache-indexed.c
... | ... | @@ -20,11 +20,10 @@ |
20 | 20 | int ret; |
21 | 21 | |
22 | 22 | ret = regcache_lookup_reg(map, reg); |
23 | - if (ret < 0) | |
24 | - *value = 0; | |
25 | - else | |
23 | + if (ret >= 0) | |
26 | 24 | *value = map->reg_defaults[ret].def; |
27 | - return 0; | |
25 | + | |
26 | + return ret; | |
28 | 27 | } |
29 | 28 | |
30 | 29 | static int regcache_indexed_write(struct regmap *map, unsigned int reg, |
drivers/base/regmap/regcache-lzo.c
... | ... | @@ -232,7 +232,6 @@ |
232 | 232 | size_t blksize, tmp_dst_len; |
233 | 233 | void *tmp_dst; |
234 | 234 | |
235 | - *value = 0; | |
236 | 235 | /* index of the compressed lzo block */ |
237 | 236 | blkindex = regcache_lzo_get_blkindex(map, reg); |
238 | 237 | /* register index within the decompressed block */ |
... | ... | @@ -261,7 +260,8 @@ |
261 | 260 | /* restore the pointer and length of the compressed block */ |
262 | 261 | lzo_block->dst = tmp_dst; |
263 | 262 | lzo_block->dst_len = tmp_dst_len; |
264 | - return 0; | |
263 | + | |
264 | + return ret; | |
265 | 265 | } |
266 | 266 | |
267 | 267 | static int regcache_lzo_write(struct regmap *map, |
drivers/base/regmap/regcache-rbtree.c