]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
regmap: debugfs: Fix more error path regressions
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Fri, 18 Sep 2020 15:22:12 +0000 (16:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:11:07 +0000 (10:11 +0100)
[ Upstream commit 1d512ee861b80da63cbc501b973c53131aa22f29 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/regmap/regmap.c

index b71f9ecddff5dbcde9cec4af17b609594aaf16dd..fff0547c26c53db46e90343e2b1b81fadf7feba7 100644 (file)
@@ -711,6 +711,8 @@ struct regmap *__regmap_init(struct device *dev,
        if (ret)
                goto err_map;
 
+       ret = -EINVAL; /* Later error paths rely on this */
+
        if (config->disable_locking) {
                map->lock = map->unlock = regmap_lock_unlock_none;
                regmap_debugfs_disable(map);