[PATCH] regmap: fix return value in regcache-indexed read call.

From: Michael Williamson
Date: Wed Dec 21 2011 - 10:44:49 EST


The regcache_read() API for regmap requires a 0 return value for
successful cached reads. The read method for the indexed type
cache implementation is returning the positive map offset for a
successful read, which is incorrect. Fix it.

Signed-off-by: Michael Williamson <michael.williamson@xxxxxxxxxxxxxxxx>
---
drivers/base/regmap/regcache-indexed.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/base/regmap/regcache-indexed.c b/drivers/base/regmap/regcache-indexed.c
index 507731a..ade5b8c 100644
--- a/drivers/base/regmap/regcache-indexed.c
+++ b/drivers/base/regmap/regcache-indexed.c
@@ -22,8 +22,10 @@ static int regcache_indexed_read(struct regmap *map, unsigned int reg,
ret = regcache_lookup_reg(map, reg);
if (ret >= 0)
*value = map->reg_defaults[ret].def;
+ else
+ return ret;

- return ret;
+ return 0;
}

static int regcache_indexed_write(struct regmap *map, unsigned int reg,
--
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/