lkml.org 
[lkml]   [2011]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regmap: fix return value in regcache-indexed read call.
Date
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@criticallink.com>
---
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


\
 
 \ /
  Last update: 2011-12-21 16:47    [W:3.882 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site