From: Charles Keepax <[email protected]>

[ 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 <[email protected]>
Signed-off-by: Charles Keepax <[email protected]>
Link: 
https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
 drivers/base/regmap/regmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index b71f9ecddff5d..fff0547c26c53 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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);
-- 
2.25.1



Reply via email to