]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
regmap: debugfs: Ensure a correct return value for empty caches
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 8 Jan 2013 13:44:50 +0000 (13:44 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 8 Jan 2013 20:52:49 +0000 (20:52 +0000)
This should never happen in the real world.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regmap-debugfs.c

index 9099cd33fbcb87f1364575e2ade64bf307e34ccc..720e14248167b81c6c5b7032d9fcefbc62b7a9b7 100644 (file)
@@ -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) {