regmap: cache Fix regcache-rbtree sync
[linux-2.6.git] / drivers / base / regmap / regcache-rbtree.c
index 92b779e..17aa318 100644 (file)
@@ -392,7 +392,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
                        base = 0;
 
                if (max < rbnode->base_reg + rbnode->blklen)
-                       end = rbnode->base_reg + rbnode->blklen - max;
+                       end = max - rbnode->base_reg + 1;
                else
                        end = rbnode->blklen;