Skip to content

Commit

Permalink
regmap: debugfs: Ensure a correct return value for empty caches
Browse files Browse the repository at this point in the history
This should never happen in the real world.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Jan 8, 2013
1 parent 95f971c commit 5bd9f4b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/base/regmap/regmap-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
}
}

/*
* This should never happen; we return above if we fail to
* allocate and we should never be in this code if there are
* no registers at all.
*/
if (list_empty(&map->debugfs_off_cache)) {
WARN_ON(list_empty(&map->debugfs_off_cache));
return base;
}

/* Find the relevant block */
list_for_each_entry(c, &map->debugfs_off_cache, list) {
if (from >= c->min && from <= c->max) {
Expand Down

0 comments on commit 5bd9f4b

Please sign in to comment.