Skip to content

Commit 5bd9f4b

Browse files
committed
regmap: debugfs: Ensure a correct return value for empty caches
This should never happen in the real world. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
1 parent 95f971c commit 5bd9f4b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/base/regmap/regmap-debugfs.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
116116
}
117117
}
118118

119+
/*
120+
* This should never happen; we return above if we fail to
121+
* allocate and we should never be in this code if there are
122+
* no registers at all.
123+
*/
124+
if (list_empty(&map->debugfs_off_cache)) {
125+
WARN_ON(list_empty(&map->debugfs_off_cache));
126+
return base;
127+
}
128+
119129
/* Find the relevant block */
120130
list_for_each_entry(c, &map->debugfs_off_cache, list) {
121131
if (from >= c->min && from <= c->max) {

0 commit comments

Comments
 (0)