summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-08 14:44:50 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-08 21:52:49 +0100
commit5bd9f4bb34c16b62725b9486a290c01b1fdfec1c (patch)
treeeeb04f9200e5e9101aa8b723ca494b9d07c86fa5 /drivers/base
parentregmap: debugfs: Discard the cache if we fail to allocate an entry (diff)
downloadlinux-5bd9f4bb34c16b62725b9486a290c01b1fdfec1c.tar.xz
linux-5bd9f4bb34c16b62725b9486a290c01b1fdfec1c.zip
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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap-debugfs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 9099cd33fbcb..720e14248167 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -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) {