regmap: Fix rbtree block base in sync
Mark Brown [Mon, 5 Mar 2012 23:28:49 +0000 (23:28 +0000)]
Otherwise we'll end up running with bogus register numbers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
(cherry picked from commit f9353e70bcebd00cd182d946083afd7d8eddd259)

Change-Id: I7615fd2d63ec29dd869585fb20a151067b53c72a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/96494
Reviewed-by: Automatic_Commit_Validation_User

drivers/base/regmap/regcache-rbtree.c

index c9dcff3..8d51916 100644 (file)
@@ -379,7 +379,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
                if (rbnode->base_reg + rbnode->blklen < min)
                        continue;
 
-               if (min < rbnode->base_reg + rbnode->blklen)
+               if (min > rbnode->base_reg)
                        base = min - rbnode->base_reg;
                else
                        base = 0;