]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
regulator: pfuze100: Fix refcount leak in pfuze_parse_regulators_dt
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 11 May 2022 11:35:05 +0000 (15:35 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 14:59:22 +0000 (16:59 +0200)
[ Upstream commit afaa7b933ef00a2d3262f4d1252087613fb5c06d ]

of_node_get() returns a node with refcount incremented.
Calling of_node_put() to drop the reference when not needed anymore.

Fixes: 3784b6d64dc5 ("regulator: pfuze100: add pfuze100 regulator driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220511113506.45185-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/regulator/pfuze100-regulator.c

index 4b8306594c3f1b1e5739240550dd9e2f8cd0dd61..8b1940110561aa4a5cf089c1290336cb52f85e88 100644 (file)
@@ -513,6 +513,7 @@ static int pfuze_parse_regulators_dt(struct pfuze_chip *chip)
        parent = of_get_child_by_name(np, "regulators");
        if (!parent) {
                dev_err(dev, "regulators node not found\n");
+               of_node_put(np);
                return -EINVAL;
        }
 
@@ -542,6 +543,7 @@ static int pfuze_parse_regulators_dt(struct pfuze_chip *chip)
        }
 
        of_node_put(parent);
+       of_node_put(np);
        if (ret < 0) {
                dev_err(dev, "Error parsing regulator init data: %d\n",
                        ret);