Skip to contentSkip to conversation

regmap: debugfs: Fix attempts to read nonexistant register blocks

PATCH New Mark Brown 1 participant 1 message Jan 2, 2013

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 regmap: debugfs: Fix attempts to read nonexistant register blocks

Return the start of the last block we tried to read rather than a position, and also make sure we update the byte position while we're at it. Without this reads that go into nonexistant areas get confused.

---
 drivers/base/regmap/regmap-debugfs.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/regmap/regmap-debugfs.c +4 -4
index 07aad78..3ec8bc5 100644
@@ -103,12 +103,12 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
 
 	/* Find the relevant block */
 	list_for_each_entry(c, &map->debugfs_off_cache, list) {
-		if (*pos >= c->min && *pos <= c->max) {
-			*pos = c->min;
+		*pos = c->min;
+
+		if (*pos >= c->min && *pos <= c->max)
 			return c->base_reg;
-		}
 
-		ret = c->max;
+		ret = c->base_reg;
 	}
 
 	return ret;
Signature · 1 line
1.7.10.4