]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
regulator: of: Add a missing 'of_node_put()' in an error handling path of 'of_regulat...
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 26 Jan 2018 22:13:44 +0000 (23:13 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 27 Aug 2018 14:40:05 +0000 (16:40 +0200)
BugLink: http://bugs.launchpad.net/bugs/1786352
[ Upstream commit 30966861a7a2051457be8c49466887d78cc47e97 ]

If an unlikely failure in 'of_get_regulator_init_data()' occurs, we must
release the reference on the current 'child' node before returning.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/regulator/of_regulator.c

index 14637a01ba2d3db64d3357ab3e4ea7ad2915ca8b..c9875355905d159827ea565affd0b26b7bc18b01 100644 (file)
@@ -305,6 +305,7 @@ int of_regulator_match(struct device *dev, struct device_node *node,
                                dev_err(dev,
                                        "failed to parse DT for regulator %s\n",
                                        child->name);
+                               of_node_put(child);
                                return -EINVAL;
                        }
                        match->of_node = of_node_get(child);