From f9353e70bcebd00cd182d946083afd7d8eddd259 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date: Mon, 5 Mar 2012 23:28:49 +0000
Subject: [PATCH] regmap: Fix rbtree block base in sync

Otherwise we'll end up running with bogus register numbers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/base/regmap/regcache-rbtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index bae183c6bcb1..313c20f8cc28 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -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;
-- 
GitLab