mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regmap: debugfs: Fix attempts to read nonexistant register blocks
@ 2013-01-02 15:34 Mark Brown
  0 siblings, 0 replies; only message in thread
From: Mark Brown @ 2013-01-02 15:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mark Brown

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.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/base/regmap/regmap-debugfs.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 07aad78..3ec8bc5 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -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;
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-02 15:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-02 15:34 [PATCH] regmap: debugfs: Fix attempts to read nonexistant register blocks Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®