regmap: debugfs: Fix more error path regressions
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Fri, 18 Sep 2020 15:22:12 +0000 (16:22 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 21 Sep 2020 23:11:45 +0000 (00:11 +0100)
Many error paths in __regmap_init rely on ret being pre-initialised to
-EINVAL, add an extra initialisation in after the new call to
regmap_set_name.

Fixes: 94cc89eb8fa5 ("regmap: debugfs: Fix handling of name string for debugfs init delays")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200918152212.22200-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap.c

index 51db0f8..a4d3d41 100644 (file)
@@ -707,6 +707,8 @@ struct regmap *__regmap_init(struct device *dev,
                }
        }
 
+       ret = -EINVAL; /* Later error paths rely on this */
+
        if (config->disable_locking) {
                map->lock = map->unlock = regmap_lock_unlock_none;
                map->can_sleep = config->can_sleep;